I am looking for a way to do exactly opposite from this example that was taken from angularjs ng-disabled documentation ... http://docs.angularjs.org/api/ng.directive:ngDisabled
In this example checking the box disables the button. I need exactly the opposite,,, I need the checked box to enable a disabled button. Can someone shed some light on this for me please.
<!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>
Thanks!
You can do:
ng-disabled="!checked"
The ! means to do the opposite, so !true == false = true
Plunkr: http://plnkr.co/edit/ht0z3lTJi8EfPJEKWcWl?p=preview
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With