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

5 Answers 5

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 { }
Sign up to request clarification or add additional context in comments.

Comments

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/

Comments

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"
}

Comments

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

Comments

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"
}

```

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.