angular / angular/components

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

Đang mở
#8,513 20 bình luận 9 reaction 0 người được giao Xem trên GitHub
area: material/form-field docs feature help wanted P4
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:**
`` 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.**

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

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

Hướng nghiên cứu

Issue không nêu tên tệp nào trong repository, test hay điểm vào của tài liệu; hãy bắt đầu bằng việc tái hiện với inline mat-error và FormGroup cha. Hoàn thành nghĩa là thêm một ví dụ rõ ràng về trường hợp validation đã được báo cáo và xác nhận rằng lỗi mong đợi được hiển thị.

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
documentation, frontend
Loại issue
Tài liệu
Độ khó
2/5
Thời gian dự kiến
1-3 giờ
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.