angular / angular/components

bug(ErrorStateMatcher): Not able to configure globally ErrorStateMatcher

Abierto
#20,097 4 comentarios 2 reacciones 0 asignados Ver en GitHub
area: material/input P3
Lenguaje dominante
TypeScript
Estrellas
25k
Forks
6.8k
Merge medio
1 d 8 h
PR fusionados (30 d)
91

Descripción

#### Reproduction

StackBlitz link for reproduction: https://stackblitz.com/edit/components-issue-enshvf

Steps to reproduce:
1. Pay your attention that CoreModule has declaration for `ErrorStateMatcher` provider with class `ShowOnDirtyErrorStateMatcher`. CoreModule imported into AppModule in the same way as FeatureModule.
2. Try to focus/blur example "Favorite Food" input and note that `ShowOnDirtyErrorStateMatcher` was not applied.

In big enterprise applications we should have clean modular structure without any SharedModule or MaterialModule to be imported into each feature module.

MatInputModule has hardcoded `ErrorStateMatcher` provider and when we import that module into our feature modules – our global `ErrorStateMatcher` provider is overwritten.

I suppose this issue related with PR #18962, but I believe this issue describes another problem with `ErrorStateMatcher`

#### Expected Behavior

ErrorStateMatcher can be defined globally

#### Actual Behavior

ErrorStateMatcher overwrites with each MatInputModule import

#### Environment

- Angular: 9+
- CDK/Material: 9+

Guía de contribución

Abrir la guía de contribución

Línea de trabajo

Comienza con la reproducción vinculada de StackBlitz y sigue cómo proporcionan ErrorStateMatcher CoreModule, FeatureModule y MatInputModule. Verifica el comportamiento del provider cuando MatInputModule se importa en varios módulos de funcionalidades; la tarea estará completada cuando un ErrorStateMatcher configurado globalmente siga siendo efectivo y el campo de entrada Favorite Food de la reproducción lo utilice.

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
Error
Dificultad
4/5
Tiempo estimado
3-5 días
Estado de actividad
Estancado
Claridad
Bastante claro
Aptitud para principiantes
48/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.