Answer the question
In order to leave comments, you need to log in
How to reset Angular Material form fields to remove validation error?
I have a form field
<mat-form-field >
<input matInput
placeholder="Password"
[formControl]="passwordFormControl"
[errorStateMatcher]="matcher"
[(ngModel)]="password">
<mat-error *ngIf="passwordFormControl.hasError('minlength')">Please enter at least 4 symbols</mat-error>
<mat-error *ngIf="passwordFormControl.hasError('required')">Password is required</mat-error>
</mat-form-field>
this.password='';
passwordFormControl
Answer the question
In order to leave comments, you need to log in
As always, I found the solution myself.
Need to dopasswordFormControl.setErrors(null)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question