I want to use disabled-ng with dynamic value returned from a function.
I have tried several ways but it is not working.
<textarea id="{{exercise.type}}" ng-disabled={{prova}}></textarea>
......
<textarea id="{{exercise.type}}" ng-disabled=prova></textarea>
......
<textarea id="{{exercise.type}}" ng-disabled=prova()></textarea>
with this javascript function
$scope.prova=function(e){
return true;
};
Or you can use ng-disabled="condition1 || condition2" , is depend of you logic conditional.
The ng-disabled Directive in AngularJS is used to enable or disable the HTML elements. If the expression inside the ng-disabled attribute returns true then the form field will be disabled or vice versa.
Q 9 - Which of the following is true about ng-disabled directive? A - ng-disabled directive can enable a given control.
AngularJS ng-hide Directive The ng-hide directive hides the HTML element if the expression evaluates to true. ng-hide is also a predefined CSS class in AngularJS, and sets the element's display to none .
Try this syntax:
ng-disabled="prova()"
Example: http://jsfiddle.net/3eqz2/2/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With