Ng-Disable-6

 

In this example of ng-disabled directive we have a textbox of email type and if you type invalid email in this textbox the submit button will disable and gets enable when you type valid email in the textbox.

 
 
 
<!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title></title> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.2/angular.min.js"></script> </head> <body ng-app> <div ng-init="name='[email protected]'"> <form name="myForm"> <label>Email</label> <input type="email" name="name" ng-model="form.name"> <input type="submit" ng-disabled="!myForm.name.$valid"> </form> </div> </body> </html>
Output