无法绑定到 'gridOptions',因为它不是 'ag-grid-angular' 的已知 属性

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

我正在尝试 运行 the example project of ag-grid 但出现以下异常:

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

代码:

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

说ag-grid-angular上没有'gridOptions'这样的道具。很奇怪,因为它来自ag-grid的官方网站。

任何帮助将不胜感激!

您似乎还没有使用 @NgModule({})

注册 AgGridModule

如果错过请尝试以下代码:

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 {
}