【问题标题】:AG-Grid with Angular2. Error while installing the ag-grid in angular2 project带有 Angular2 的 AG 网格。在 angular2 项目中安装 ag-grid 时出错
【发布时间】:2017-01-15 05:13:49
【问题描述】:

我是 angular2 的新手。在我的基本 angular2 项目中,我尝试放置 ag-grid。我收到错误

node_modules/ag-grid-ng2/lib/ng2ComponentFactory.d.ts(3,10): error TS2305: Module 
'"C:/practice/quickstart/node_modules/@angular/compiler/index"' has no exported member 'RuntimeCompiler'.

package.json

    "ag-grid": "6.4.x",
    "ag-grid-enterprise": "6.4.x",
    "ag-grid-ng2": "6.4.x",

systemjs.config.js

'ag-grid': 'node_modules/ag-grid',
'ag-grid-ng2': 'node_modules/ag-grid-ng2'

packages: {
      'ag-grid-ng2': {
        defaultExtension: "js"
      },
      'ag-grid': {
        defaultExtension: "js"
      },
    }

app.module.ts

import {AgGridModule} from 'ag-grid-ng2/main';
@NgModule({
  imports:      [ 
    BrowserModule,
    AgGridModule.withNg2ComponentSupport(),
  ],
  declarations: [ AppComponent ],
  bootstrap:    [ AppComponent ]
})
export class AppModule { }

在 app.module.ts 文件中,使用 Ng2ComponentSupport() 会出错。

【问题讨论】:

    标签: angular typescript ag-grid


    【解决方案1】:

    根据您的消息,我猜您正在使用 angular 2 2.3+ - 如果是这样,那么问题是 ag-grid-ng2 6.x 不支持此版本。

    Angular 2 使 ag-grid-ng2 所依赖的 RuntimeCompiler 不公开(好吧,移动了它等等)。

    如果你想使用 Angular 2.3+,那么你需要升级到支持它的 ag-grid-ng2 7.x

    【讨论】:

    • 有任何带有基本示例的演示项目 angular2+ag-grid 我认为它会对我有所帮助。
    • github.com/ceolter/ag-grid-ng2-example repo 有很多可以查看的示例,包括 webpack、systemjs 和 angular-cli 的示例
    • 感谢@SeanLandsman。我是这些主题的新手,而不是总回购,我可以获得基本的,以便我可以学习它并在我的项目中使用基本的。
    猜你喜欢
    • 1970-01-01
    • 2018-03-16
    • 1970-01-01
    • 2018-10-10
    • 1970-01-01
    • 2017-09-26
    • 2016-05-06
    • 2019-11-07
    • 2017-01-28
    相关资源
    最近更新 更多