AG-Grid + Angular 6 =兼容?

时间:2018-06-18 11:00:17

标签: ag-grid angular6

刚开始使用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)...

2 个答案:

答案 0 :(得分:1)

是的,它是兼容的。

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

答案 1 :(得分:0)

在执行ng build --prod时要小心。 ag-grid 20.0.0的angular 6.0.0 prod版本存在问题。它不会渲染GRID。在进行构建时,buildOptimize = false;