我有以下方法尝试添加新的手风琴实例。有没有一种方法可以直接动态地创建组件,而不必创建新的“ MyAccordionComponent”类型的类文件并导入?
buildAccordion(){
let accConfig = new AccordionConfig();
let accordionComponent = new AccordionComponent(accConfig);
accordionComponent['class'] = 'accord';
let accordionPanelComponent = new AccordionPanelComponent(accordionComponent);
accordionPanelComponent.heading = "data_name";
accordionPanelComponent.panelClass = "panel_10";
accordionComponent.addGroup(accordionPanelComponent);
const componentRef = this.componentFactoryResolver.resolveComponentFactory(accordionComponent); // error occurs here!!
this.viewContainerRef.createComponent(componentRef);
}