【Angular】Did you add it to @NgModule.entryComponents? の対処法2019年5月31日2020年2月7日 angular/materialのSpinner系を実装したページでテスト実行したら、 Did you add it to @NgModule.entryComponents? って怒られて、調べても直接的な対処法出てこないし、いろいろ手探りでやっていって何とか対処できたので備忘録として対処法記載しておきます。 Contents1. overrideModule ってやつ使えば行けるらしい1.1. 共有:1.2. 関連 overrideModule ってやつ使えば行けるらしい そもそも overrideModule ってなに?って感じで、今でもよくわかっていない(公式サイトにも詳細書いていない)のですが、以下のような感じで書いてあげると行けました。 beforeEach(async(() => { TestBed.configureTestingModule({ declarations: [ ・・・component, ], imports: [ ・・・module, ], }) .overrideModule(BrowserDynamicTestingModule, {set: {entryComponents: [MatSpinner]}}) // こんな感じで追加できるよ! .compileComponents(); })); もともとのエラーに書いてあるけど、@NgModuleにentryComponents追加して?って書いてあるので、追加できるような関数みたいですね。 テストモジュールに直接setできるみたいなので、こちら記載してあげればいったんはエラー回避できるかと思います。 共有:クリックして Twitter で共有 (新しいウィンドウで開きます)Facebook で共有するにはクリックしてください (新しいウィンドウで開きます)関連 angular,プログラミング,開発Angular,Jasmine,Karma,テストPosted by naomiti3333