Form Validations AngularJS
HTML5 provides some attributes that can be used to validate the input fields. required: required ensures that form field must not be empty. <input name="studentName" ng-model="studentName" required> email: email ensures that form field value is in email format. <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.1/angular.min.js"></script> <input name="studentName" ng-model="studentName" type="email"> <div ng-app="clickApp" ng-controller="clickCtrl"> Validating state of the form and input fields: AngularJS provides a number of states for form and its controls. Properties of the input fields: $pristine – Returns true if input field is not modified. $dirty – Returns true if input field is modified. $invalid – Returns true if content input field is not […]
