ng- disabled directive is used to enable or disable HTML elements. Let us see this with the help of an example.
Write the following HTML mark up in the webpage.
- <!doctype html>
- <html ng-app>
- <head>
- <title>My Angular App</title>
- <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js"></script>
- </head>
- <body>
- <div ng-app="" ng-init="Switch=true">
- <p>
- <input type="checkbox" ng-model="Switch"/>
- </p>
- <p>
- <button ng-disabled="Switch">Submit</button>
- </p>
- </div>
- </body>
- </html>
So let us check the output of the program.

When we select the checkbox let us see what happens!!

So the button is disabled. In this way we can enable or disable a control in AngularJS.

Debasis SahaPosted May 12, 2016, 3:44 PM
Nice share..
Thiruppathi RPosted May 12, 2016, 3:02 AM
Good..