AngularJS ng-disabled directive
AngularJS instance
Disable or enable the input box:
<!DOCTYPE html><html><head><meta charset="utf-8"><script src="http://apps.bdimg.com/libs/angular.js/1.4.6/angular.min.js"></script></head><body ng-app="">Click here to disable all form input fields: <input type="checkbox" ng-model="all"><br><br><input type="text" ng-disabled="all"><input type="radio" ng-disabled="all"><select ng-disabled="all"> <option>Female</option> <option>Male</option> </select></body></html>
Definition and usage
The ng-disabled directive sets the disabled attribute (input, select, or textarea) of the form input field.
If the expression in ng-disabled returns true, the form field will be disabled.
grammar
<input ng-disabled="expression"></input>
The <input>, <select>, and <textarea> elements all support this directive.
Parameter value
| value | describe |
|---|---|
| Expression | If the expression returns true, set to the element to add a disabled property. |
The above is a compilation of the basic knowledge of the ng-disabled instruction, and we will continue to add relevant knowledge in the future.