我试图实现以下示例之一:
https://www.ag-grid.com/ag-grid-angular2-support/
colDef = {
// instead of cellRenderer we use cellRendererFramework
cellRendererFramework: {
template: '{{params.value | currency}}',
moduleImports: [CommonModule]
},
// specify all the other fields as normal
headerName: "Currency Pipe Template",
field: "value",
width: 200
模块中的导入:
@NgModule({
imports: [
.....
AgGridModule.withComponents([])
],
我收到以下错误:
ERROR错误:找不到[object Object]的组件工厂 . 你有没有把它添加到@ NgModule.entryComponents? at noComponentFactoryError(core.es5.js:3302)[angular] at _NullComponentFactoryResolver.resolveComponentFactory(core.es5.js:3320)[angular] at CodegenComponentFactoryResolver.resolveComponentFactory(core.es5.js:3362)[angular] at CodegenComponentFactoryResolver.resolveComponentFactory (core.es5.js:3362)[angular] at Ng2ComponentFactory.createComponent(ng2ComponentFactory.js:149)[angular] at CellRenderer.createComponent(ng2ComponentFactory.js:47)[angular] at CellRenderer.BaseGuiComponent.init(ng2ComponentFactory.js) :167)[angular]在CellRenderer.init(ng2ComponentFactory.js:34)[angular] at CellRendererService.useCellRenderer(cellRendererService.js:49)[angular] at RenderedCell.useCellRenderer(renderedCell.js:1009)[angular] at RenderedCell .putDataIntoCell(renderedCell.js:957)[angular]在RenderedCell.populateCell(renderedCell.js:784)[angular] at RenderedCell.init(renderedCell.js:323)[angular] at vendor.bundle.js:19006:115 [角]
我得到同样的错误:
@NgModule({
imports: [
.....
AgGridModule.withComponents([CommonModule])
],
或者:
colDef = {
// instead of cellRenderer we use cellRendererFramework
cellRendererFramework: {
template: '{{params.value}}'
},
// specify all the other fields as normal
headerName: "Currency Pipe Template",
field: "value",
width: 200
@NgModule({
imports: [
.....
AgGridModule.withComponents([])
],
导入或entryComponents的正确模块是什么?