Search within TutorialsPark

AngularJS Forms Validation


Learn how to use AngularJS to Create and Validate Forms, using Attributes Directives and Variables


AngularJS Forms: Form Validation

AngularJS can be used form Validation using a set of HTML elements,attributes, and some Directives.

In the demo, the box is enabled when the value is provided for both the input, and the terms and condition option is checked.


: AngularJS Forms Form Elements and Bi-directional Data Binding

Give it a TRY! » Note: The event submit is triggered when the user submits the form.

AngularJS Forms : Track the Validity Status of Form

AngularJS provides a set of variables which are used to monitor the validation state of the form elements individually and also as a complete set.

Example: AngularJS Form Validation Variables for Form Directives

Name Description
$pristine If no interaction is made with the form element, a true is returned.
$dirty If the user has interacted with the element/form, a true is returned.
$valid If the input value provided for form elements are valid, a true is returned.
$invalid If the input value provided for the form element are invalid, a true is returned.
$error To provide a detailed feedback to user about the errors in form.

A Detailed use of these variables to provide feedback to the user is explained in the next chapter.