Open
Description
Reproduction
StackBlitz link for reproduction: https://stackblitz.com/edit/components-issue-enshvf
Steps to reproduce:
- Pay your attention that CoreModule has declaration for
ErrorStateMatcher
provider with classShowOnDirtyErrorStateMatcher
. CoreModule imported into AppModule in the same way as FeatureModule. - 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+