What is Angular Validation?
Angular Forms and controls in AngularJS give validation services and inform users of invalid input. AngularJS provides us with different information about a form or its inputs and is applied to a form and inputs.
To track error following terms are used:
- $dirty− states that value has been altered.
- $error− states the exact error.
- $invalid− states that value entered is invalid.
Watch this Full Stack Web Development Course Video:

e.g.
<!DOCTYPE html><br> <html><br> <script src= "http://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js"></script><br> <body><br> <h1>Example of Validation</h1><br> <form ng-app="myApp" ng-controller="validateCtrl"<br> name="intellipaatForm" novalidate><br> <p>Username:<br><br> <input type="text" name="username" ng-model="username" required><br> <span style="color:red" ng-show="intellipaatForm.username.$dirty && intellipaatForm.username.$invalid"><br> <span ng-show="intellipaatForm.username.$error.required">Username is required.</span><br> </span><br> </p><br> <p>Email:<br><br> <input type="email" name="email" ng-model="email" required><br> <span style="color:red" ng-show="intellipaatForm.email.$dirty && intellipaatForm.email.$invalid"><br> <span ng-show="intellipaatForm.email.$error.required">Email is required.</span><br> <span ng-show="intellipaatForm.email.$error.email">Invalid email address.</span><br> </span><br> </p><br> <p><br> <input type="submit"<br> ng-disabled="intellipaatForm.username.$dirty && intellipaatForm.username.$invalid ||<br> intellipaatForm.email.$dirty && intellipaatForm.email.$invalid"><br> </p><br> </form><br> <script><br> var app = angular.module('myApp', []);<br> app.controller('validateCtrl', function($scope) {<br> $scope.username = 'abc';<br> $scope.email = 'abc@intellipaat.com';<br> });<br> </script><br> </body><br> </html><br>
Output
If you remove the name of the id from the text box it shows the following output: