【问题标题】:AG-Grid + Angular 6 = Compatible?AG-Grid + Angular 6 = 兼容?
【发布时间】:2018-11-27 05:04:10
【问题描述】:

刚开始使用 Angular,所以显然使用 NG6

尝试使用 AG-Grid 创建一个演示来证明付费版本的成本是合理的,但按照他们网站上的简单步骤开始操作给我以下错误。 让我先确保这个组件与 Angular 6 兼容?

干杯, 否

Uncaught Error: Template parse errors:
Can't bind to 'rowData' since it isn't a known property of 'ag-grid-angular'.
1. If 'ag-grid-angular' is an Angular component and it has 'rowData' input, then verify that it is part of this module.
2. If 'ag-grid-angular' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message.
3. To allow any property add 'NO_ERRORS_SCHEMA' to the '@NgModule.schemas' of this component. ("   style="width: 500px; height: 500px;" 
                class="ag-theme-balham" 
                [ERROR ->][rowData]="rowData" 
                [columnDefs]="columnDefs">
            </ag-grid-angular>
"): ng:///AppModule/AppComponent.html@11:16
Can't bind to 'columnDefs' since it isn't a known property of 'ag-grid-angular'.
1. If 'ag-grid-angular' is an Angular component and it has 'columnDefs' input, then verify that it is part of this module.
2. If 'ag-grid-angular' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message.
3. To allow any property add 'NO_ERRORS_SCHEMA' to the '@NgModule.schemas' of this component. ("
                class="ag-theme-balham" 
                [rowData]="rowData" 
                [ERROR ->][columnDefs]="columnDefs">
            </ag-grid-angular>

"): ng:///AppModule/AppComponent.html@12:16
'ag-grid-angular' is not a known element:
1. If 'ag-grid-angular' is an Angular component, then verify that it is part of this module.
2. If 'ag-grid-angular' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message. ("
        <div class="col-10">

            [ERROR ->]<ag-grid-angular 
                style="width: 500px; height: 500px;" 
                class="ag-t"): ng:///AppModule/AppComponent.html@8:12
    at syntaxError (compiler.js:215)
    at TemplateParser.push../node_modules/@angular/compiler/fesm5/compiler.js.TemplateParser.parse (compiler.js:14702)...

【问题讨论】:

    标签: ag-grid angular6


    【解决方案1】:

    是的,它是兼容的。

    我一直是个白痴,在 app-routing.module 中添加了代码,而不是 app.module。 (n00b!!)

    【讨论】:

      【解决方案2】:

      在执行 ng build --prod 时要小心。 ag-grid 20.0.0 与 angular 6.0.0 prod build 存在问题。它不会渲染网格。在进行构建集 buildOptimization=false;

      【讨论】:

        猜你喜欢
        • 2019-03-16
        • 2019-01-24
        • 2023-03-13
        • 2018-10-26
        • 2019-12-04
        • 2018-11-22
        • 2021-09-03
        • 2022-10-19
        • 2020-03-07
        相关资源
        最近更新 更多