问题
I am currently trying to convert a project I have that is using AG Grid free to enterprise free trial. However, when following the instructions on the AG Grid site I am getting this error:
Uncaught TypeError: Cannot read property 'EnterpriseCoreModule' of undefined
Thinking it might probably be due to the project I created I tried building on a new one but I am still getting the same error.
Has anyone encountered this error? Looked on the net and could didn't find any results. Can anyone help in activating my AG Grid to enterprise?
回答1:
Fine. let's proceed installation step by step
- install all dependencies
npm i --save ag-grid-angular
npm i --save ag-grid-community
npm i --save ag-grid-enterprise
- import deps in
app.module.ts
import {AgGridModule} from "ag-grid-angular";
@NgModule({
imports: [
AgGridModule.withComponents([])]
})
- import ag-Grid styles - in
styles.scss
@import "~@ag-grid-community/all-modules/dist/styles/ag-grid.css";
@import "~@ag-grid-community/all-modules/dist/styles/ag-theme-balham.css";
4.setting the license key in main.ts
but the order of the modules is IMPORTANT!
We recommend setting the license key in your main boot files (typically named either main.ts or boot.ts, before you bootstrap your application.
import { LicenseManager } from "ag-grid-enterprise";
LicenseManager.setLicenseKey("YOUR_KEY");
platformBrowserDynamic().bootstrapModule(AppModule).catch(err => console.error(err));
来源:https://stackoverflow.com/questions/59196371/error-when-converting-ag-grid-to-enterprise