0

I tried to implement one of the following examples:

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

The import in the module:

@NgModule({
  imports: [
    .....
    AgGridModule.withComponents([])
],

I get the following error:

ERROR Error: No component factory found for [object Object]. Did you add it to @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] at 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] at RenderedCell.populateCell (renderedCell.js:784) [angular] at RenderedCell.init (renderedCell.js:323) [angular] at vendor.bundle.js:19006:115 [angular]

I get the same error with:

@NgModule({
  imports: [
    .....
    AgGridModule.withComponents([CommonModule])
],

Or with:

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

What is the correct module for the import or for the entryComponents??

Amit Chigadani
  • 28,482
  • 13
  • 80
  • 98
Jogi
  • 1
  • 1
  • 1
    Are you on ag-grid version 6.x? because from version 7 after [they changed how components are handled](https://www.ag-grid.com/ag-grid-angular2-support-v7/) Take a look at this [similar question](https://stackoverflow.com/q/44025481/5187323) – Jarod Moser Jun 08 '17 at 21:10
  • This is another question and I use the newest version. I want to use a template in the CellRendererFramework and not a component (like in the question). To bind a component works in my project, but i want to use a template, for example for a pipe. I don't want to create a component, only for a pipe. – Jogi Jun 09 '17 at 06:16

0 Answers0