我正在寻找一种与这个取自 angularjs ng-disabled 文档的示例完全相反的方法... http://docs.angularjs.org/api/ng.directive:ngDisabled
在此示例中,选中该框会禁用该按钮。我需要恰恰相反,我需要复选框来启用禁用的按钮。有人可以帮我解释一下吗?
<!doctype html>
<html ng-app>
<head>
<script src="http://code.angularjs.org/1.2.0/angular.min.js"></script>
</head>
<body>
Click me to toggle: <input type="checkbox" ng-model="checked"><br/>
<button ng-model="button" ng-disabled="checked">Button</button>
</body>
</html>
谢谢!
最佳答案
你可以这样做:
ng-disabled="!checked"
!
的意思是相反,所以 !true == false = true
关于javascript - Angularjs - 复选框禁用和启用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19963549/