angular / angular/components

bug(ErrorStateMatcher): Not able to configure globally ErrorStateMatcher

オープン
#20,097 コメント 4 件 リアクション 2 件 担当者 0 名 GitHub で見る
area: material/input P3
主要言語
TypeScript
スター
25k
フォーク
6.8k
平均マージ
1日 8時間
マージ済み PR(30日)
91

説明

#### 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+

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

リンクされた StackBlitz の再現から始め、ErrorStateMatcher が CoreModule、FeatureModule、MatInputModule によってどのように提供されるかを追跡します。MatInputModule が複数の feature module で import された場合の provider の動作を確認します。グローバルに設定された ErrorStateMatcher が引き続き有効で、再現の Favorite Food input がそれを使用すれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
angular, typescript
領域
frontend
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
48/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。