angular / angular/components

(feat) Chips: validation for chips

未关闭
#8,801 9 条评论 24 个 reaction 已指派 0 人 在 GitHub 查看
area: material/chips feature forms G P2
主要语言
TypeScript
星标
25k
派生
6.8k
平均合并
1 天 8 小时
30 天内合并 PR
91

描述

#### Bug, feature request, or proposal: feature

#### What is the expected behavior?
Custom validators and `mat-error` should work when placing a chip-list inside a mat-form-field
There should be a two-fold validation: if there is a nested input for adding new chips, the input should validate entry previous to adding it.
The data of the whole chip-list should be validated.
It should work seamlessly with ngModel and validation api.

#### What is the current behavior?
The nested input cant be validated.
The form-field is bound to the chip-list control state, but the chip-list's `value` doesn't hold the whole array, but just the selected item.
It doesn't react to addition/insertions, so no validation can be trigger/shown

#### What are the steps to reproduce?
Providing a StackBlitz/Plunker (or similar) is the *best* way to get the team to see your issue.

Plunker starter (using on `@master`): https://goo.gl/uDmqyY

StackBlitz starter (using latest `npm` release): https://goo.gl/wwnhMV

#### What is the use-case or motivation for changing an existing behavior?
Use the chip-list control to edit array data in a form, and properly validate the input

#### Which versions of Angular, Material, OS, TypeScript, browsers are affected?

#### Is there anything else we should know?

贡献指南

打开贡献指南

调研方向

从链接的 Plunker 或 StackBlitz 复现开始,跟踪 mat-form-field 中的 mat-chip-list,包括嵌套的 input 和表单绑定。完成标准是自定义验证器和 mat-error 对芯片输入以及整个 chip-list 都能正常工作,并且新增内容会通过 ngModel 和验证 API 反映出来。

由索引模型根据 Issue 内容生成。

评估

技术栈
angular, typescript
领域
frontend
Issue 类型
功能
难度
5/5
预计耗时
一周以上
活跃度
停滞
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。