angular / angular/components

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

Đang mở
#9,007 19 bình luận 11 reaction 0 người được giao Xem trên GitHub
area: material/form-field P3
Ngôn ngữ chính
TypeScript
Star
25k
Fork
6.8k
Merge trung bình
1 ngày 8 giờ
Pull request đã merge (30 ngày)
91

Mô tả

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

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Hướng nghiên cứu

Bắt đầu với bản tái hiện StackBlitz được liên kết và so sánh hành vi của mat-error đối với các control matInput và mat-select được thêm vào một FormArray. Kiểm tra các control chưa được chạm vào sau khi submit và sau khi chúng được chạm vào. Hoàn thành khi lỗi validation xuất hiện lúc submit cho mọi trường không hợp lệ mà không yêu cầu trường đó phải được chạm vào.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
angular, typescript
Lĩnh vực
frontend
Loại issue
Lỗi
Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
35/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.