angular / angular/components

bug(ErrorStateMatcher): Not able to configure globally ErrorStateMatcher

Aperta
#20,097 4 commenti 2 reazioni 0 assegnatari Vedi su GitHub
area: material/input P3
Lingua principale
TypeScript
Stelle
25k
Fork
6.8k
Merge medio
1g 8h
PR unite (30g)
91

Descrizione

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

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Inizia dalla riproduzione StackBlitz collegata e segui come ErrorStateMatcher viene fornito da CoreModule, FeatureModule e MatInputModule. Verifica il comportamento del provider quando MatInputModule viene importato in più moduli di funzionalità; l'attività è completata quando un ErrorStateMatcher configurato globalmente rimane effettivo e l'input Favorite Food della riproduzione lo utilizza.

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

Valutazione

Stack tecnologico
angular, typescript
Ambito
frontend
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
48/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.