mat-form-field does not remove mat-form-field-invalid class on FormGroup reset
- 主要语言
- TypeScript
- 星标
- 25k
- 派生
- 6.8k
- 平均合并
- 1 天 8 小时
- 30 天内合并 PR
- 91
描述
#### Bug, feature request, or proposal:
Bug
#### What is the expected behavior?
Upon resetting a FormGroup, I would expect the visual state of the form to be reset also.
#### What is the current behavior?
The form group and controls are reset but the mat-input-invalid class remains on the md-input-container suggesting that the control is invalid.
#### What are the steps to reproduce?
This only seems to happen when the [formGroup] attribute is on a form tag. Works as expected on a div tag.
Create component with a FormGroup and a FormControl with Validators.required .
Create a form tag with the [formGroup] attribute.
Add an input control to the form with a required attribute.
When running, fill out the form so its valid, then reset the form and model through the click handler on a button. The required control will now have the mat-input-invalid class.
#### Which versions of Angular, Material, OS, browsers are affected?
Angular 4.0.1
Material 2.0.0-beta.3
Windows 10
Chrome 57
贡献指南
调研方向
首先,使用表单元素上的 Angular FormGroup 和必填 FormControl 重现该问题,然后将其与相同控件位于 div 上的情况进行比较。通过相关的 Angular Material 源代码跟踪表单重置和 mat-form-field 验证状态;当重置 group 移除 invalid 类并为两个容器保留预期行为时,即表示完成。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- angular, typescript
- 领域
- frontend
- Issue 类型
- 缺陷
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 活跃度
- 冷清
- 描述清晰度
- 基本清楚
- 新手友好度
- 48/100