Cannot bind to 'gridOptions' since it isn't a known property of 'ag-grid-angular'

Alon picture Alon · May 29, 2017 · Viewed 14.4k times · Source

I'm trying to run the example project of ag-grid but getting the following exception:

Can't bind to 'gridOptions' since it isn't a known property of 'ag-grid-angular'

Code:

<div style="width: 200px;">
  <ag-grid-angular #agGrid style="width: 100%; height: 200px;" 
    [gridOptions]="gridOptions" class="ag-fresh">
  </ag-grid-angular>
</div>

It says that there isn't such a prop as 'gridOptions' on ag-grid-angular. It's weird since it comes from the official website of ag-grid.

Any help will be profoundly appreciated!

Answer

Suneet Bansal picture Suneet Bansal · May 29, 2017

It seems you have not registered AgGridModule with @NgModule({})

Please try below code if missed:

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

import {AppComponent} from "./app.component";
import {MyGridApplicationComponent} from "./my-grid-application/my-grid-application.component";
import {RedComponentComponent} from "./red-component/red-component.component";

@NgModule({
    declarations: [
        AppComponent,
        MyGridApplicationComponent,
        RedComponentComponent
    ],
    imports: [
        BrowserModule,
        AgGridModule.withComponents(
            [RedComponentComponent]
        )
    ],
    providers: [],
    bootstrap: [AppComponent]
})
export class AppModule {
}