angular / angular/components

feat(mat-select): add "select other" optional functionality

Offen
#10,185 7 Kommentare 5 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
area: material/select feature P4
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?
Add "select other" / "select custom" *optional* functionality to `mat-select`. This would provide a seamless way for a dev to let a user select from a predefined list of drop down items _**or**_ to provide a custom selection. I imagine if someone chose the "other" option of a `mat-select` dropdown, a `matInput` text field would appear and accept input. Crucially, user updates to this "other" `matInput` field would change the value of the `FormControl` associated with the `mat-select` field.

#### What is the current behavior?

Currently, this functionality can already be achieved however it is not easy. In my app I have made a custom "select-other" form control by combining a `mat-select` and `matInput` controls, both of which have their own `FormControl`. The component needs to flatten output from both of these controls so that I can interact with the component by just giving it one `FormControl` as input. It works, but it's not super clean. I'm assuming that a "select other" option (similar to a Google Form's "other" radio button option) is a pretty common design need.

#### What is the use-case or motivation for changing an existing behavior?
Increase developer happiness.

#### Which versions of Angular, Material, OS, TypeScript, browsers are affected?
5.x

#### Is there anything else we should know?

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

Beginne damit, die Angular Material mat-select- und matInput-Einstiegspunkte zu lesen, und überprüfe anschließend, wie ihre zugehörigen FormControls derzeit Werte bereitstellen. Lege fest, wie eine optionale Auswahl "other" und benutzerdefinierter Text mit mat-select und dem FormControl interagieren sollen, und richte Tests für vordefinierte und benutzerdefinierte Auswahlen vor der Implementierung ein.

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
25/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.