生成生成后,在componentFactoryResolver中获取未匹配的对象

时间:2018-05-24 06:44:10

标签: angular

我正在尝试基于模板动态创建组件

More infomation

在我的代码中

component.ts

 var factories = Array.from(this.componentFactoryResolver['_factories'].keys());
 let factoryClass = <Type<any>>factories.find((x: any) => x.name === this.comp);
 let componentFactory = this.componentFactoryResolver.resolveComponentFactory(factoryClass);
 let componentRef = this.theBody.createComponent(componentFactory);

在开发环境中

 factories===>
 ..............
  function CranchecklisttemplateComponent(cran) {
    this.cran = cran;
    this.componentlist = [];
    this.model = {};
}
.............

构建后

 factories===>
     ..............
      function t(t){this.cran=t,this.componentlist=[],this.model={}}
    }
    .............

为什么函数参数在ng build之后未匹配。我在我的项目中使用了aot build false。

0 个答案:

没有答案