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



我正在尝试运行Ag-Grid的示例项目,但获得以下例外:

不能与"网格托"结合,因为它不是已知的属性" 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-Gungular上没有"网格"的道具。这很奇怪,因为它来自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 {
}

相关内容

最新更新