동적으로 자식으로 생성하는 구성 요소 클래스를받는 구성 요소가 있습니다. 이 & 렌더링 생성하는 TestBed에 대해 "entryComponents"를 제공합니다.
let componentFactory = this.componentFactoryResolver.resolveComponentFactory(componentToCreate);
this.componentReference = this.target.createComponent(componentFactory);
는 좀 TestComponent을 단위 테스트를 작성하고 전달하는 데 노력하고있어. "TestComponent에 대한 찾을 수 없습니다 부품 공장": "어떤"
configureTestingModule
이
TestModuleMetadata
을 기대하기 때문에
entryComponents
을 가지고 있지만 내가하지 않는 오류가 캐스팅되어
TestBed
.configureTestingModule(<any>{
declarations: [MyAwesomeDynamicComponentRenderer, TestHostComponent],
entryComponents: [TestComponent],
});
.
entryComponents
을 TestBed
에 어떻게 제공합니까?
그것은 나를 많이 도왔습니다. 고마워요! – trichetriche
예! 그것은 작동! 정말 고맙습니다!! – llstarscreamll
StackOverflow 만 해답을 여러 번 upvote 할 수 있습니다! –