Flat 10% & upto 50% off + Free additional Courses. Hurry up!

AngularJS Validation


Forms and controls in AngularJS give validation services and inform users of invalid input. AngularJS provides us different information about a form or its inputs and are 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.


<!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';

$ = '';







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


"0 Responses on AngularJS Validation"

100% Secure Payments. All major credit & debit cards accepted Or Pay by Paypal.

Sales Offer

  • To avail this offer, enroll before 19th November 2017.
  • This offer cannot be combined with any other offer.
  • This offer is valid on selected courses only.
  • Please use coupon codes mentioned below to avail the offer

Sign Up or Login to view the Free AngularJS Validation.