Search code examples
angularag-gridag-grid-ng2

node_modules/ag-grid/main"' has no exported member 'IHeaderGroup'


I'm quiet new to angular 4 & trying to use ag-grid from here https://www.ag-grid.com/ag-grid-angular-angularcli/#gsc.tab=0.

I keep getting errors like below and I couldn't find any links that were helpful:

node_modules/ag-grid-angular/dist/interfaces.d.ts (1,10): Module '"C:/Use rs/shm/A4/first-app/node_modules/ag-grid/main"' has no exported member 'IHeaderGroup'.

node_modules/ag-grid-angular/dist/interfaces.d.ts (1,24): Module '"C:/Use rs/shm/A4/first-app/node_modules/ag-grid/main"' has no exported member 'IHeaderGroupParams'.

ag-grid-angular/dist/interfaces.d.ts (1,44): Module '"C:/Use rs/shm/A4/first-app/node_modules/ag-grid/main"' has no exported member 'IHeader'.

//app.module.ts
import {AgGridModule} from 'ag-grid-angular';
import { RedComponentComponent } from './red-component/red-component.component';
import { MyAgGridComponent } from './my-ag-grid/my-ag-grid.component';

        @NgModule({
          declarations: [
            AppComponent,
            SpinnerComponent,
            RedComponentComponent,
            MyAgGridComponent,
          ],
          imports: [
            BrowserModule,
            HttpClientModule, HttpModule,
            FormsModule,
            BrowserAnimationsModule,
            MdButtonModule,
            MdProgressSpinnerModule,
            MdInputModule,
            AgGridModule.withComponents([RedComponentComponent]),
          ],
          exports: [SpinnerComponent],
          providers: [],
          bootstrap: [AppComponent]
        })
        export class AppModule {}

package.json

"ag-grid-angular": "^12.0.0",
    "ag-grid-ng2": "^8.0.0",
    "core-js": "^2.4.1",
    "rxjs": "^5.1.0",

Can anyone help me figure out a solution for this?


Solution

  • I can see two problems with what you have:

    • Use either ag-grid-angular or ag-grid-ng2. ag-grid-angular is the dependency to use going forward, it replaces ag-grid-ng2
    • You need to import as follows:

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