Check if a form is dirty or invalid from Controller

Updated on     Kisan Patel

Check if a form is dirty or invalid from Controller.

// `formName` is value of name attribute of the form.
// If form is dirty.
if ($scope.formName.$dirty) {
}

// If form is invalid.
if ($scope.formName.$invalid) {
}

Read More: Handling Form Validation in AngularJS


AngularJS

Leave a Reply