Tutorials References Exercises Bootcamps Videos Menu
Sign Up Create Website Get Certified Upgrade

AngularJS ng-disabled Directive


Disable / enable the input field:

Disable form fields: <input type="checkbox" ng-model="all">
<input type="text" ng-disabled="all">
<input type="radio" ng-disabled="all">
<select ng-disabled="all">
Try it Yourself »

Definition and Usage

The ng-disabled directive sets the disabled attribute of a form field (input, select, or textarea).

The form field will be disabled if the expression inside the ng-disabled attribute returns true.

The ng-disabled directive is necessary to be able to shift the value between true and false. In HTML, you cannot set the disabled attribute to false (the presence of the disabled attribute makes the element disabled, regardless of its value).


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

Supported by <input>, <select>, and <textarea> elements.

Parameter Values

Value Description
expression An expression that will set the element's disabled attribute if it returns true.