3

I am using angular.js version 1.1.5 which has $setPristine on the form controller. But this method does not seem to clear any errors associated with fields. The code below works for me, but I am not sure whether this is the right way to clear errors. Any advice?

In my controller:

if ($scope.myform) {
    $scope.myform.$setPristine();
    delete $scope.myform.myfield.$error.myvalidator;
}

1 Answer 1

6

The $setPristine() clears only the flag dirty in a form but the validation in a form are cleared with $setValidity()

Sign up to request clarification or add additional context in comments.

1 Comment

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.