He ( FormGroup
) behaves correctly. Your form requires a username and password, so when you reset the form must be invalid (i.e. a form without a username / password is invalid).
, , , ( ), . , .
AFAIK, <mat-error>
FormGroupDirective
, FormGroup
, FormGroup
reset FormGroupDirective
. , <mat-error>
reset FormGroupDirective
.
:
<form [formGroup]="myForm" #formDirective="ngForm"
(ngSubmit)="submitForm(myForm, formDirective)">
formDirective.resetForm()
:
private submitForm(formData: any, formDirective: FormGroupDirective): void {
formDirective.resetForm();
this.myForm.reset();
}
GitHub: https://github.com/angular/material2/issues/4190