Tuesday, 30 May 2023

AG-Grid Angular Import 2023

 import { AgGridModule } from "ag-grid-angular";

import 'ag-grid-enterprise';

@NgModule({
  declarations: [AppComponent],
  imports: [BrowserModule, AgGridModule],
  providers: [],
  bootstrap: [AppComponent]
})
export class AppModule {}
// also v28 not recommended to use @ag-grid-enterprise/all-modules
// Since v28 the AgGridModule no longer needs the .withComponents() method as all user applications will now be using Ivy. The method used to handle registering custom components as EntryComponents but that is no longer required with Ivy and was deprecated by Angular.

So to fix this error make the follow change and your custom components will still work.

- AgGridModule.withComponents([CustomComp]);
+ AgGridModule

// if imported in shared module, export AgGridModule


https://stackoverflow.com/questions/63414155/how-to-import-ag-grid-enterprise-in-my-angular-7-project

https://stackoverflow.com/questions/72881136/property-withcomponents-does-not-exist-on-type-typeof-aggridmodule


// set up enterprise licnese

main.ts

import { environment } from './environments/environment';

import { LicenseManager } from  'ag-grid-enterprise'


if (environment.agGridLicenseKey) {

  LicenseManager.setLicenseKey(environment.agGridLicenseKey);

}


enviroments/environment.ts and environment.prod.ts

agGridLicenseKey: 'XXXX'


No comments:

Post a Comment