bug(ErrorStateMatcher): Not able to configure globally ErrorStateMatcher
- Ngôn ngữ chính
- TypeScript
- Star
- 25k
- Fork
- 6.8k
- Merge trung bình
- 1 ngày 8 giờ
- Pull request đã merge (30 ngày)
- 91
Mô tả
#### 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+
Hướng dẫn đóng góp
Hướng nghiên cứu
Bắt đầu với bản tái hiện StackBlitz được liên kết và theo dõi cách ErrorStateMatcher được cung cấp bởi CoreModule, FeatureModule và MatInputModule. Xác minh hành vi của provider khi MatInputModule được import trong nhiều feature module; được coi là hoàn tất khi một ErrorStateMatcher được cấu hình toàn cục vẫn có hiệu lực và input Favorite Food trong bản tái hiện sử dụng nó.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- angular, typescript
- Lĩnh vực
- frontend
- Loại issue
- Lỗi
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 48/100