mat-select in multiple mode is difficult to use with reactive forms
- Vorherrschende Sprache
- TypeScript
- Sterne
- 25k
- Forks
- 6.8k
- Ø Merge
- 1 T. 8 Std.
- Gemergte PRs (30 T.)
- 91
Beschreibung
#### Bug, feature request, or proposal:
feature request
#### What is the expected behavior?
`mat-select` in `multiple` mode lets me put `formControls` on individual options
#### What is the current behavior?
I have a list of boolean options (checkboxes) that a user can set. `formControl` only works on the mat-select, which is populated with an array. If I want to prepopulate those, I need to manually build an array to set on my `mat-select`. I cannot bind to `valueChanges` on individual options.
#### What is the use-case or motivation for changing an existing behavior?
Manually keeping this array updated and in sync with my individual settings is painful. I'd rather create `formControl`s for each option, which I can bind to and set/patch as I need to. Perhaps let me set a `formGroup` on the `mat-select` instead of a `formControl`?
#### Which versions of Angular, Material, OS, TypeScript, browsers are affected?
"@angular/core": "5.2.9",
"@angular/material": "5.2.4",
"typescript": "2.8.1"
#### Is there anything else we should know?
Beitragsleitfaden
Rechercherichtung
Beginne damit, das gemeldete mat-select-Setup im multiple-mode mit Angular reactive forms zu reproduzieren, und konzentriere dich auf das Verhalten von formControl für den select im Vergleich zu einzelnen options und deren valueChanges. Erledigt ist die Aufgabe, wenn Benutzer einzelne option controls binden und vorbefüllen können, ohne ein Array manuell synchronisieren zu müssen, und die unterstützte form API sowie das Verhalten durch Tests dokumentiert sind.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- angular, typescript
- Bereich
- frontend
- Issue-Typ
- Feature
- Schwierigkeit
- 5/5
- Geschätzter Aufwand
- Über eine Woche
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 35/100