angular / angular/components

mat-form-field does not remove mat-form-field-invalid class on FormGroup reset

オープン
#4,190 コメント 74 件 リアクション 88 件 担当者 0 名 GitHub で見る
area: material/form-field P3
主要言語
TypeScript
スター
25k
フォーク
6.8k
平均マージ
1日 8時間
マージ済み PR(30日)
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 のバリデーション状態を確認します。グループをリセットすると invalid クラスが削除され、両方のコンテナで期待される動作が維持されれば完了です。

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

評価

技術スタック
angular, typescript
領域
frontend
issue の種類
バグ
難易度
3/5
見積もり時間
1〜2日
活発さ
静か
明瞭さ
おおむね明確
初心者へのやさしさ
48/100

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

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