AngularJS ng-disabled directive
AngularJS instance
Disable or enable the input box:
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <script src="/libs//1.4.6/"></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
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 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.