के लिए "entryComponents" मैं एक घटक है जो गतिशील रूप से एक बच्चे के रूप में बनाने के लिए घटक के एक घटक के वर्ग प्राप्त करता है।प्रदान करना एक टेस्टबेड
let componentFactory = this.componentFactoryResolver.resolveComponentFactory(componentToCreate);
this.componentReference = this.target.createComponent(componentFactory);
मैं इसे बनाने के लिए & प्रस्तुत करना एक इकाई परीक्षण लिखने और कुछ TestComponent पारित करने के लिए कोशिश कर रहा हूँ।
TestBed
.configureTestingModule(<any>{
declarations: [MyAwesomeDynamicComponentRenderer, TestHostComponent],
entryComponents: [TestComponent],
});
वहाँ "किसी भी" क्योंकि configureTestingModule
TestModuleMetadata
उम्मीद जो entryComponents
नहीं है, लेकिन मैं मिलता है त्रुटि के कास्टिंग है: "कोई घटक TestComponent के लिए पाया कारखाने"।
मैं कैसे entryComponents
एक TestBed
को प्रदान कर सकते हैं?
यह मुझे बहुत मदद की, धन्यवाद! – trichetriche
हाँ !! यह काम करता हैं!! बहुत बहुत धन्यवाद!! – llstarscreamll
यदि केवल स्टैक ओवरफ्लो आपको एक से अधिक बार एक उत्तर देने देता है! –