Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't get ag-grid on Angular 2 to work, any recent tutorial?

Can anyone help me to find a good and recent (working) tutorial for ag-grid on Angular 2?

I can't get the tutorial on the offical ag-grid website to work...

Maybe some code could help me too?

Thanks in advance!

Error: EXCEPTION: Error in ./MyGridApplicationComponent class MyGridApplicationComponent - inline template:1:4 caused by: No provider for BaseComponentFactory!

Edit

And now AgGridModule.forRoot() is working, first it wasn't permitted or something...

And a new error:

ERROR in Error encountered resolving symbol values statically. Calling function 'AgGridModule', function calls are not supported. Consider replacing the function or lambda with a reference to an exported function, resolving symbol AppModule in C:/Users/Milan/Documents/Octopus/Octopus 2.0/src/app/app.module.ts, resolving symbol AppModule in C:/Users/Milan/Documents/Octopus/Octopus 2.0/src/app/app.module.ts

like image 961
Milan_w Avatar asked Mar 09 '17 12:03

Milan_w


Video Answer


2 Answers

I didn't have any luck with AgGridModule.forRoot() either. However importing AgGridModule in the module that uses the grid fixed this error for me.

@NgModule({
  imports: [
    ...
    AgGridModule.withComponents([])
  ]...
like image 52
phil-hawkins Avatar answered Sep 30 '22 06:09

phil-hawkins


I'm using the Angular2-CLI https://github.com/angular/angular-cli, but this examples from the Grid-Author himself work like a charm: https://github.com/ceolter/ag-grid-angular-example/tree/master/angular-cli

The good thing at this examples: You can just clone it, start an "ng serve" and you have a running set of all the examples. I suggest you give it a try, otherwise it's quite cumbersome to get this Grid working.

I also searched quite a while, but due to the recent breaking changes and renamings, other examples than the GitHub-Repo itself don't work anymore. I had to find that out the hard way.

like image 30
Matthias Müller Avatar answered Sep 30 '22 04:09

Matthias Müller