feat(mat-select): add "select other" optional functionality
- Langage dominant
- TypeScript
- Étoiles
- 25k
- Forks
- 6.8k
- Merge moyen
- 1 j 8 h
- PR mergées (30 j)
- 91
Description
#### 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?
Guide de contribution
Ouvrir le guide de contribution
Piste de recherche
Commencez par lire les points d’entrée Angular Material mat-select et matInput, puis examinez la manière dont leurs FormControls associés exposent actuellement les valeurs. Définissez comment un choix facultatif "other" et un texte personnalisé doivent interagir avec mat-select et le FormControl, puis mettez en place des tests pour les sélections prédéfinies et personnalisées avant l’implémentation.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- angular, typescript
- Domaine
- frontend
- Type d'issue
- Fonctionnalité
- Difficulté
- 5/5
- Temps estimé
- Plus d'une semaine
- Activité
- À l'abandon
- Clarté
- Plutôt claire
- Accessibilité débutants
- 25/100