私は子として動的に作成するコンポーネントのコンポーネントクラスを受け取るコンポーネントを持っています。TestBedに「entryComponents」を提供
let componentFactory = this.componentFactoryResolver.resolveComponentFactory(componentToCreate);
this.componentReference = this.target.createComponent(componentFactory);
私はユニットテストを書いて、それがレンダリング&を作成するためのいくつかのTestComponentに合格しようとしています。
TestBed
.configureTestingModule(<any>{
declarations: [MyAwesomeDynamicComponentRenderer, TestHostComponent],
entryComponents: [TestComponent],
});
configureTestingModule
がentryComponents
を持っているが、私はエラーを取得しないTestModuleMetadata
見込んでいるため、「あらゆる」にキャストすることがあります:「TestComponentが見つかりません部品工場を」。
entryComponents
をTestBed
に提供するにはどうすればよいですか?
それは私をたくさん助けてくれました、ありがとう! – trichetriche
はい!できます!!どうもありがとうございます!! – llstarscreamll
StackOverflowだけがあなたに複数回答えをアップアップさせるなら! –