AngularJS ng-disabledDirective

AngularJS 参考手册AngularJS Reference Manual


AngularJS Example

Disable or enable the input box:

Disable form input 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>

Try it Yourself »

Definition and Usage

ng-disabledThe directive sets the disabled attribute of form input fields (input, select, or textarea).

Ifng-disabledthe expression inside it returns true, the form field will be disabled.


Syntax

<input ng-disabled="expression"></input>

The <input>, <select>, and <textarea> elements all support this directive.


Parameter Values

Value Description
expression If the expression returns true, the disabled attribute is added to the element.

AngularJS 参考手册AngularJS Reference Manual

Other Extensions