angular / angular/components

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

オープン
#8,513 コメント 20 件 リアクション 9 件 担当者 0 名 GitHub で見る
area: material/form-field docs feature help wanted P4
主要言語
TypeScript
スター
25k
フォーク
6.8k
平均マージ
1日 8時間
マージ済み PR(30日)
91

説明

**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.**

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

Issue にはリポジトリのファイル、テスト、ドキュメントのエントリポイントが記載されていないため、まず inline mat-error と親の FormGroup を使った再現から始めます。報告されたバリデーションケースの明確な例を追加し、期待されるエラーが表示されることを確認すれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
angular, typescript
領域
documentation, frontend
issue の種類
ドキュメント
難易度
2/5
見積もり時間
1〜3時間
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。