Reputation: 398
I have a directive:
<my-directive data-watched-expression='watchedAttribute1 || watchedAttribute2'> </my-directive>
And inside directive template I have:
<input ng-readonly="{{watchedExpression}}"/>
What would be the best solution to be able to reevaluate the expression, when properties watchedAttribute1 or watchedAttribute2 changes outside of the directive? If possible, I would like to archieve this without passing these variables to the directive...
Upvotes: 0
Views: 42
Reputation: 48968
The ng-readonly
directive takes an Angular expression. Don't use interpolation.
<!-- Do this -->
<input ng-readonly="watchedExpression"/>
<!-- Not this
<input ng-readonly="{{watchedExpression}}"/>
-->
The ng-src
, ng-srcset
, and ng-href
directives are interpolated. The other attribute directives take Angular expressions.
Upvotes: 1