[input] Add example of using mat-error with parent formgroup validation
- 主要语言
- TypeScript
- 星标
- 25k
- 派生
- 6.8k
- 平均合并
- 1 天 8 小时
- 30 天内合并 PR
- 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 没有指定任何 repository 文件、测试或文档入口;请先从 inline mat-error 和父级 FormGroup 的复现开始。完成标准是添加一个清晰的已报告验证场景示例,并确认预期错误已显示。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- angular, typescript
- 领域
- documentation, frontend
- Issue 类型
- 文档
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100