使用Angular,当我从组件类数组动态创建组件时。
constructor(private componentFactoryResolver: ComponentFactoryResolver) { }
addComponent(class: Type<any>) {
const componentFactory = this.componentFactoryResolver.resolveComponentFactory(class);
const component = container.createComponent(componentFactory);
component.instance.title = comp.title;
}
并像这样创建
for (let class of classes) {
this.addComponent(class);
}
垂直显示组件
class1
class2
class3
class4
反正有这样的东西吗?
class1 class2
class3 class4