gpt4 book ai didi

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

转载 作者:数据小太阳 更新时间:2023-10-29 05:07:07 25 4
gpt4 key购买 nike

我正在尝试运行 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”这样的 Prop 。很奇怪,因为它来自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 {
}

关于javascript - 无法绑定(bind)到 'gridOptions',因为它不是 'ag-grid-angular' 的已知属性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44238607/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com