Home>

angularjs ng-disabled directive

angularjs example

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="">
<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 a form input field.

If the expression in ng-disabled returns true, the form fields will be disabled.

grammar

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

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

Parameter value

value description
expression If the expression returns true, set the element to add the disabled attribute.

  • Previous Detailed usage of XUtils3 framework in Android (1)
  • Next jQuery get and set the height of the iframe