【发布时间】:2018-04-07 15:55:35
【问题描述】:
我有一个组件,我使用下面的代码使用视图子和组件工厂动态加载了该组件
@Input() dynamicComponent: Observable<any>;
@ViewChild('expandablerow', { read: ViewContainerRef }) rowContainers;
loadComponent( component) {
if (component) {
if (this.rowContainers > 0) { this.rowContainers.clear(); }
const factory: ComponentFactory<any> = this.resolver.resolveComponentFactory(component);
const inlineComponent = this.rowContainers.createComponent(factory);
}
}
但我在这里尝试实现的是替换以下列表之一 当用户单击黄色编辑按钮时带有详细信息组件。 我有一个功能可以根据单击的行获取数据,但我被困在那里
【问题讨论】:
-
感谢我找到了解决方案
标签: angular angular5 dynamic-loading viewchild