ionic-team / ionic-team/ionic-framework
feat: Allow integration of Angular custom form controls with ion-item validation behavior
- 主要语言
- TypeScript
- 星标
- 52.7k
- 派生
- 13.3k
- 平均合并
- 1 天 15 小时
- 30 天内合并 PR
- 51
描述
# Feature Request
**Ionic version:**
[x] 5.3.1
**Describe the Feature Request**
Ionic/Angular has a nice UI feature that presents validation status to users in the form of CSS classes that map to the ng form control classes. eg,` ng-valid/ng-invalid` maps to `ion-valid/ion-invalid` etc. And these classes somehow get pushed to the containing `ion-item` of the control which does the actual presentation.
We have several custom form control components and we would like to have them behave in the same manner. But there doesn't seem to be an easy way to integrate with this functionality.
Please provide a mechanism to integrate custom form controls with the ion-item valid/invalid presentation behavior.
We currently cannot implement this behavior and our forms do not function well when custom form controls are used within `ion-item` lists.
**Describe Preferred Solution**
An abstract version of Ionic's [`ValueAccessor`](https://github.com/ionic-team/ionic-framework/blob/master/angular/src/directives/control-value-accessors/value-accessor.ts) class that components could extend would be nice. This seems to be where the magic happens.
**Describe Alternatives**
Alternatively, a number of public hooks that could be called to patch the Angular functions and set the Ionic classes would also work.
贡献指南
调研方向
Start with angular/src/directives/control-value-accessors/value-accessor.ts, which the issue identifies as the source of the existing validation behavior. Trace how it connects Angular custom form controls to ion-item classes, then define and document a public integration mechanism. Done means custom controls can trigger the same valid/invalid presentation inside ion-item.
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- angular, typescript
- 领域
- frontend
- Issue 类型
- 功能
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100