angular / angular/components

mat-error does not display on submit when fields are added in a FormArray

Ouverte
#9,007 19 commentaires 11 réactions 0 personnes assignées Voir sur GitHub
area: material/form-field P3
Langage dominant
TypeScript
Étoiles
25k
Forks
6.8k
Merge moyen
1 j 8 h
PR mergées (30 j)
91

Description

#### Bug, feature request, or proposal:
The `mat-error` directive doesn't display on submit when fields are added in a FormArray. The error is shown when you touch the field. Also when I change the mat-error to a regular div, the div is just being shown.

#### What is the expected behavior?
Show `mat-error` on submit when field is untouched.

#### What is the current behavior?
Does not show `mat-error` on submit when field is untouched.

#### What are the steps to reproduce?
Repro: https://angular-material2-issue-ttt1jk.stackblitz.io/
- Add some fields with Angular Validators in a FormArray (this counts for every field, mat-select, matInput, etc.)

I have HTML like this:
- mat-form-field
-- mat-select
-- mat-error

Or:
- mat-form-field
-- input matInput
-- mat-error

#### What is the use-case or motivation for changing an existing behavior?
Validation needs to be shown on submit so the user knows the field has errors.

#### Which versions of Angular, Material, OS, TypeScript, browsers are affected?
- Angular v5.1.0
- Material v5.0.1
- TypeScript v2.4.2
- Every browser

#### Is there anything else we should know?

Guide de contribution

Ouvrir le guide de contribution

Piste de recherche

Commencez par la reproduction StackBlitz liée et comparez le comportement de mat-error pour les contrôles matInput et mat-select ajoutés à un FormArray. Vérifiez les contrôles non touchés après la soumission, puis après qu’ils ont été touchés. C’est terminé lorsque les erreurs de validation apparaissent lors de la soumission pour chaque champ invalide sans qu’il soit nécessaire de toucher le champ.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
angular, typescript
Domaine
frontend
Type d'issue
Bug
Difficulté
3/5
Temps estimé
1-2 jours
Activité
À l'abandon
Clarté
Plutôt claire
Accessibilité débutants
35/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.