directive ngDisabled
如果在ngDisabled的表达式计算为truthy,该指令设置了元素上的禁用属性(通常是表单控件,如输入、按钮、选择等等)。
用法:
index.html
<html ng-app="extendApp"> <head> <meta charset="UTF-8"> <title></title> <script src="framework/angular.js"></script> <script src="js/aaa.js"></script> </head> <body> <label>Click me to toggle: <input type="checkbox" ng-model="checked"></label><br/> <button ng-disabled="checked">Button</button> </body> </html>
script.js
angular.module("extendApp",[])
.controller("extendController",function ($scope) {
$scope.checked = false;
});