angular / angular/components

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

Aperta
#9,007 19 commenti 11 reazioni 0 assegnatari Vedi su GitHub
area: material/form-field P3
Lingua principale
TypeScript
Stelle
25k
Fork
6.8k
Merge medio
1g 8h
PR unite (30g)
91

Descrizione

#### 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?

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Inizia con la riproduzione collegata in StackBlitz e confronta il comportamento di mat-error per i controlli matInput e mat-select aggiunti a un FormArray. Verifica i controlli non toccati dopo l'invio e dopo che sono stati toccati. È completato quando gli errori di convalida vengono visualizzati all'invio per ogni campo non valido senza richiedere che il campo sia stato toccato.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
angular, typescript
Ambito
frontend
Tipo di issue
Bug
Difficoltà
3/5
Tempo stimato
1-2 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.