angular / angular/components

Cannot set custom global ErrorStateMatcher for lazy loaded modules

Open
#10,084 17 comments 13 reactions 0 assignees View on GitHub
area: material/core P3
Dominant language
TypeScript
Stars
25k
Forks
6.8k
Avg merge
1d 8h
Merged PRs (30d)
91

Description

#### Bug, 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

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the shown ErrorStateMatcher provider configuration with Angular 5.1.3 and Material 5.2.2, comparing root and lazy-loaded modules. Trace how the custom matcher is resolved in each module. Done means the application-wide matcher applies inside lazy-loaded modules without duplicating the provider.

Written by the indexing model from the issue text.

Assessment

Tech stack
angular, typescript
Domain
frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.