AngularJS ng-disabled Directive
Definition and Usage
ng-disabled
The directive sets the disabled attribute of the form field (input, select, or textarea).
If ng-disabled
The expression in the attribute returns true, then the form field will be disabled.
ng-disabled
Instructions are necessary for values that can switch between true and false. In HTML, you cannot set the disabled attribute to false (the presence of the disabled attribute will disable the element regardless of its value).
Example
Enable/Disable input fields:
Disable form fields: <input type="checkbox" ng-model="all"> <br> <input type="text" ng-disabled="all"> <input type="radio" ng-disabled="all"> <select ng-disabled="all"> <option>Female</option> <option>Male</option> </select>
Syntax
<input ng-disabled="expression</input>
is affected by <input>
、<select>
and <textarea>
Element Support.
Parameters
Parameters | Description |
---|---|
expression | If the expression returns true, then the disabled attribute of the element will be set. |