-
Notifications
You must be signed in to change notification settings - Fork 6.8k
Open
Labels
P4A relatively minor issue that is not relevant to core functionsA relatively minor issue that is not relevant to core functionsarea: material/form-fielddocsThis issue is related to documentationThis issue is related to documentationfeatureThis issue represents a new feature or feature request rather than a bug or bug fixThis issue represents a new feature or feature request rather than a bug or bug fixhelp wantedThe team would appreciate a PR from the community to address this issueThe team would appreciate a PR from the community to address this issue
Description
Bug, feature request, or proposal:
<mat-error>
doesn't show when I use an email maching validator for emails inputs.
What is the expected behavior?
To display the error.
What is the current behavior?
No error is displayed
What are the steps to reproduce?
Set a custom validator for check if two emails inputs are equals, like this :
private matchEmail(AC: AbstractControl) {
return AC.get('mail').value === AC.get('mailconfirm').value ? null : { mailmismatch: true };
}
this.administratifForm = this.fb.group({
(...),
mail: this.fb.control('', [Validators.required, Validators.email]),
mailconfirm: this.fb.control('', [Validators.required]),
(...),
}, {
validator: this.matchEmail,
},
);
The template :
<mat-form-field>
<input matInput placeholder="Vérification d'email" formControlName="mailconfirm">
<mat-error *ngIf="administratifForm.get('mailconfirm').hasError('required')">
Ce champ est requis
</mat-error>
<mat-error *ngIf="administratifForm.hasError('mailmismatch')">
Les adresses mail ne correspondent pas
</mat-error>
</mat-form-field>
Which versions of Angular, Material, OS, TypeScript, browsers are affected?
Angular 5.0.2, Material 5.0.0-rc0, MacOS Sierra, Firefox
Additional Information
If i replace the <mat-error>
tag by a <p>
tag (or anything else), it's work.
nhducseuit, fyodorio, Lowkey2224, olaf89, aritrikdas and 4 more
Metadata
Metadata
Assignees
Labels
P4A relatively minor issue that is not relevant to core functionsA relatively minor issue that is not relevant to core functionsarea: material/form-fielddocsThis issue is related to documentationThis issue is related to documentationfeatureThis issue represents a new feature or feature request rather than a bug or bug fixThis issue represents a new feature or feature request rather than a bug or bug fixhelp wantedThe team would appreciate a PR from the community to address this issueThe team would appreciate a PR from the community to address this issue