Cannot set custom global ErrorStateMatcher for lazy loaded modules
See original GitHub issueBug, feature request, or proposal:
Bug
What is the expected behavior?
There should be ability to override ErrorStateMatcher for the whole application
What is the current behavior?
@NgModule({ providers: [ {provide: ErrorStateMatcher, useClass: CustomErrorStateMatcher} ] })
CustomErrorStateMatcher being provided in the application root module aren’t applied inside of lazy loaded modules. Thus it is necessary to duplicate providing of custom error state matcher in every lazy loaded module.
What is the use-case or motivation for changing an existing behavior?
It is reasonable to have ability to override error state matcher bahavior for the whole app no matter it consists of lazy or non-lazy modules
Which versions of Angular, Material, OS, TypeScript, browsers are affected?
Angular 5.1.3 Material 5.2.2
Issue Analytics
- State:
- Created 6 years ago
- Reactions:13
- Comments:14
Top Results From Across the Web
Custom ErrorStateMatcher does not work when provided on ...
I want to implement a custom ErrorStateMatcher to show errors even when the formControl is not toched for a matInput from a 3rd...
Read more >Lazy-loading feature modules - Angular
Setting up a lazy-loaded feature module requires two main steps: Create the feature module with the Angular CLI, using the --route flag. Configure...
Read more >mat-error shows only when from-control was touched-angular.js
Create a custom ErrorStateMatcher · Declare a filed of the newly created type in your component code · Refer to the custom error...
Read more >Angular Forms and Validations
We wanted to create the most complete angular forms tutorial, so we also added advanced custom validators. If this is your first time...
Read more >Lazy Loading | webpack
We'll add an interaction to log some text to the console when the user clicks a button. However, we'll wait to load that...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I was facing the same issue, however after adding an empty constructor to the CustomErrorStateMatcher, it started working for me.
–
Hope this helps.
Still an issue in Angular 9 / Material 9.
The empty constructor @adnanmamajiwala mentioned does not work either.