angular / angular/components

mat-select in multiple mode is difficult to use with reactive forms

Aperta
#11,006 3 commenti 4 reazioni 0 assegnatari Vedi su GitHub
area: material/select P4
Lingua principale
TypeScript
Stelle
25k
Fork
6.8k
Merge medio
1g 8h
PR unite (30g)
91

Descrizione

#### 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?

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Inizia riproducendo la configurazione segnalata di mat-select in multiple-mode con Angular reactive forms, concentrandoti sul comportamento di formControl per il select rispetto alle singole options e ai relativi valueChanges. Il lavoro sarà completato quando gli utenti potranno associare e precompilare singoli option controls senza sincronizzare manualmente un array e la form API supportata e il comportamento saranno documentati tramite test.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
angular, typescript
Ambito
frontend
Tipo di issue
Funzionalità
Difficoltà
5/5
Tempo stimato
Più di una settimana
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.