2

Trying to use cellRendererFramework(v13.1.2) with angular2 but getting this error instead:

ProductComponentComponent.html:7 ERROR Error: No component factory found for [object Object]. Did you add it to @NgModule.entryComponents? at noComponentFactoryError (core.es5.js:3202)

Is cellRendererFramework not supported in ag-grid v13.1.2? Or is there some other issue.

Something similar has been asked earlier but didn't found any helpful answer.Please help with this. Thanks in advance.

  • 1
    Possible duplicate of [No component factory found. Did you add it to @NgModule.entryComponents?](https://stackoverflow.com/questions/45412915/no-component-factory-found-did-you-add-it-to-ngmodule-entrycomponents) – Shubham Tiwari Mar 05 '18 at 01:34

5 Answers5

2

Here's what I did. ( Version 19.1.1).

In app.module.ts, Import your renderers with AgGridModule.withComponents as

    @NgModule({
      declarations: [
        AppComponent
      ],
      imports: [
         ...
           AgGridModule.withComponents([
              ActionRendererComponent,
              YesnoRendererComponent, 
              StatusRendererComponent
          ])
      ],
      providers: [],
      bootstrap: [AppComponent]
    })
    export class AppModule { }
Abdul Rehman Sayed
  • 6,532
  • 7
  • 45
  • 74
1

I added the component to the @NgModule's entryComponents, as the error message points to. For example...

@NgModule({
imports: [
    CommonModule,
    SharedModule,
    ...
],
declarations: [
    ...
    myRendererComponent,
    ...
],
providers: [
    ...
],
entryComponents: [
    myRendererComponent
]

See https://hassantariqblog.wordpress.com/2017/02/12/angular2-error-no-component-factory-found-did-you-add-it-to-ngmodule-entrycomponents/

steverippl
  • 378
  • 4
  • 15
0

It might be a bit late but I ended up here while having the same issue. Here is how I fixed it, in the grid options:

this.gridOptions = <GridOptions>{
  ...
  frameworkComponents: {
    "checkboxRenderer": CheckboxCellRendererComponent
  }
}

then in the column defs:

{
  field: "present",
  headerName: "User was present",
  cellRenderer: "checkboxRenderer"
}
remborg
  • 528
  • 3
  • 14
0

If the above two solutions are not working then it is highly likely that you are passing string to ComponentFactoryResolver when loading data from server but it should be component type.

Check this url : Stack overflow

Shubham Tiwari
  • 693
  • 1
  • 5
  • 18
0

Couple of things as mentioned in previous answers, I got it working by doing couple of things.

in module definition, add your renderer for both declarations and entryComponents.

```

declarations: [ReportHyperlinkCellRenderer],
entryComponents: [ReportHyperlinkCellRenderer],

```

define your GridOptions as

```

{
  frameworkComponents: {
    "hyperlinkRenderer": ReportHyperlinkCellRenderer
  }
}

```

afterwards, your ColDef can be just simple as

```

{
  cellRenderer: "hyperlinkRenderer"
}

```

windmaomao
  • 7,120
  • 2
  • 32
  • 36