angular / angular/components

[input] Add example of using mat-error with parent formgroup validation

Offen
#8,513 20 Kommentare 9 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
area: material/form-field docs feature help wanted P4
Vorherrschende Sprache
TypeScript
Sterne
25k
Forks
6.8k
Ø Merge
1 T. 8 Std.
Gemergte PRs (30 T.)
91

Beschreibung

**Bug, feature request, or proposal:**
`` 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 :
```



Ce champ est requis


Les adresses mail ne correspondent pas

```

**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 `` tag by a `

` tag (or anything else), it's work.**

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

Das Issue nennt keine Repository-Datei, keinen Test und keinen Einstiegspunkt in der Dokumentation; beginne mit der Reproduktion mit inline mat-error und dem übergeordneten FormGroup. Als abgeschlossen gilt das Hinzufügen eines klaren Beispiels für den gemeldeten Validierungsfall und die Bestätigung, dass der erwartete Fehler angezeigt wird.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
angular, typescript
Bereich
documentation, frontend
Issue-Typ
Dokumentation
Schwierigkeit
2/5
Geschätzter Aufwand
1-3 Stunden
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
35/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.