ag-grid angular2 cellRendererFramework没有找到组件工厂

时间:2017-06-08 13:17:35

标签: angular ag-grid

我尝试实现以下示例之一:

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([])
],

我收到以下错误:

  

错误错误:找不到[object Object]的组件工厂。你是否   将它添加到@ NgModule.entryComponents?       at noComponentFactoryError(core.es5.js:3302)[angular]       at _NullComponentFactoryResolver.resolveComponentFactory(core.es5.js:3320)[angular]       在CodegenComponentFactoryResolver.resolveComponentFactory(core.es5.js:3362)[angular]       在CodegenComponentFactoryResolver.resolveComponentFactory(core.es5.js:3362)[angular]       at Ng2ComponentFactory.createComponent(ng2ComponentFactory.js:149)[angular]       在CellRenderer.createComponent(ng2ComponentFactory.js:47)[有角度]       在CellRenderer.BaseGuiComponent.init(ng2ComponentFactory.js:167)[有角度]       在CellRenderer.init(ng2ComponentFactory.js:34)[有角度]       在CellRendererService.useCellRenderer(cellRendererService.js:49)[angular]       at RenderedCell.useCellRenderer(renderedCell.js:1009)[angular]       at RenderedCell.putDataIntoCell(renderedCell.js:957)[angular]       at RenderedCell.populateCell(renderedCell.js:784)[angular]       at RenderedCell.init(renderedCell.js:323)[angular]       在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的正确模块是什么?

0 个答案:

没有答案