我正在尝试基于模板动态创建组件
在我的代码中
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。