mat-form-field does not remove mat-form-field-invalid class on FormGroup reset
- Vorherrschende Sprache
- TypeScript
- Sterne
- 25k
- Forks
- 6.8k
- Ø Merge
- 1 T. 8 Std.
- Gemergte PRs (30 T.)
- 91
Beschreibung
#### 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
Beitragsleitfaden
Rechercherichtung
Beginne damit, das Problem mit einer Angular FormGroup und einem erforderlichen FormControl auf einem Formularelement zu reproduzieren, und vergleiche es dann mit denselben Controls auf einem div. Verfolge das Zurücksetzen des Formulars und den Validierungsstatus von mat-form-field durch den relevanten Angular Material-Quellcode; abgeschlossen ist die Aufgabe, wenn das Zurücksetzen der Gruppe die invalid-Klasse entfernt und das erwartete Verhalten für beide Container beibehält.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- angular, typescript
- Bereich
- frontend
- Issue-Typ
- Bug
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Aktivitätsstatus
- Ruhig
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 48/100