动态组件加载器与索引无法正常工作

时间:2017-05-24 15:49:21

标签: angular angular2-routing angular2-components

我有一个组件列表,通过异步调用为其提供数据。我基于行位置动态地将这些组件添加到锚点。如果我没有指定行号,组件会在获取数据后立即添加到视图中。但是我需要它们根据行位置进行跟踪,这不会发生

switch{
case "grid":
    this.factory = this.componentFactoryResolver.resolveComponentFactory(GridComponent1);
    this.ref = this.coloneanchor.createComponent(component, rowLocation);
    this.ref.instance.gridData = this.favFilterData;
    this.ref.instance.gridTitle = gadget.Name;
    this.ref.changeDetectorRef.detectChanges();

case "donut":

  this.factory = this.componentFactoryResolver.resolveComponentFactory(donut);
    this.ref = this.coloneanchor.createComponent(component, rowLocation);
    this.ref.instance.gridData = this.favFilterData;
    this.ref.instance.gridTitle = gadget.Name;
    this.ref.changeDetectorRef.detectChanges();
}

0 个答案:

没有答案