<!DOCTYPE html> <html> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.9/angular.min.js"></script> <body> <div ng-app="" ng-init="mySwitch=true"> <p> <button ng-disabled="mySwitch">Click Here!</button> </p> <p> <input type="checkbox" ng-model="mySwitch"/>Checkbox </p> <p> {{ mySwitch }} </p> </div> </body> </html>
Output:
ng-disabled directive binds application data to the disabled attribute of HTML elements
Working Code Asked question September 21, 2023