angular / angular/components

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

Abierto
#10,185 7 comentarios 5 reacciones 0 asignados Ver en GitHub
area: material/select feature P4
Lenguaje dominante
TypeScript
Estrellas
25k
Forks
6.8k
Merge medio
1 d 8 h
PR fusionados (30 d)
91

Descripción

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

Guía de contribución

Abrir la guía de contribución

Línea de trabajo

Empieza leyendo los puntos de entrada de Angular Material mat-select y matInput, y después revisa cómo sus FormControls asociados exponen actualmente los valores. Define cómo deben interactuar una opción opcional "other" y un texto personalizado con mat-select y el FormControl, y establece pruebas para selecciones predefinidas y personalizadas antes de la implementación.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
angular, typescript
Área
frontend
Tipo de issue
Nueva funcionalidad
Dificultad
5/5
Tiempo estimado
Más de una semana
Estado de actividad
Estancado
Claridad
Bastante claro
Aptitud para principiantes
25/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.