How to Implement Form Validation in Angular? - Explained

Process Advisors

*Subject to Terms and Condition

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:


<!DOCTYPE html>
<script src= ""></script>
<h1>Example of Validation</h1>
<form ng-app="myApp" ng-controller="validateCtrl"
name="intellipaatForm" novalidate>
<input type="text" name="username" ng-model="username" required>
<span style="color:red" ng-show="intellipaatForm.username.$dirty && intellipaatForm.username.$invalid">
<span ng-show="intellipaatForm.username.$error.required">Username is required.</span>
<input type="email" name="email" ng-model="email" required>
<span style="color:red" ng-show="$dirty &&$invalid">
<span ng-show="$error.required">Email is required.</span>
<span ng-show="$">Invalid email address.</span>
<input type="submit"
ng-disabled="intellipaatForm.username.$dirty && intellipaatForm.username.$invalid ||$dirty &&$invalid">
var app = angular.module('myApp', []);
app.controller('validateCtrl', function($scope) {
$scope.username = 'abc';
$ = '[email protected]';


If you remove the name of the id from the text box it shows the following output:

If you are an AngularJS enthusiast, enroll in the Angular Certification Course and get certified now!

Course Schedule

Name Date Details
Web Development Courses 07 Oct 2023(Sat-Sun) Weekend Batch
View Details
Web Development Courses 14 Oct 2023(Sat-Sun) Weekend Batch
View Details
Web Development Courses 21 Oct 2023(Sat-Sun) Weekend Batch
View Details

Leave a Reply

Your email address will not be published. Required fields are marked *

Find Best AngularJS Training in Other Regions

Bangalore Hyderabad Chennai Mumbai