English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

AngularJS ng-disabled directive

AngularJS Reference Manual

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<script src="https://cdn.staticfile.org/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>
Test and see ‹/›

Definition and Usage

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

If ng-disabled The expression returns true, then the form field will be disabled.

Syntax

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

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

Parameter Value

ValueDescription
expressionIf the expression returns true, set the element to add the disabled attribute.

AngularJS Reference Manual