R01010010
R01010010

Reputation: 5958

Angular: Reset validation state of all controls in a form

I need to "reset" the state (validations too) of a form every time i'm going to revalidate it. I know $setPristine() function but this doesn't reset the validation state of the controls (i want to remove ng-invalid css-class).

Is there a function to do this to all the controls in a form at once?

I'm in Angular 1.3.8

Upvotes: 2

Views: 283

Answers (1)

hjl
hjl

Reputation: 2802

use $setValidity to change the validity state and notify the form

https://docs.angularjs.org/api/ng/type/ngModel.NgModelController

Upvotes: 0

Related Questions