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+
Metadata
Metadata
Assignees
Labels
Type
Projects
Milestone
Relationships
Development
No branches or pull requests
Activity
crisbeto commentedon Jul 26, 2020
We should follow the same pattern as in the
MatDateSelectionModel
(SkipSelf
+Optional
) when providing the defaultErrorStateMatcher
so that any higher-level defaults are picked up.basters commentedon Jul 26, 2020
Do you need my help with fixing this?
nicolae536 commentedon Dec 10, 2020
Yes this would be very helpfull cause right now you cannot override the default you can pass it using inputs but that creates a lot of boilerplate. A hacky fix would be
ngehlert commentedon May 3, 2022
is this still an issue? any updates? does it make sense to create a MR for this?