Angular 2:TypeError:core_1.NgModule不是函数

时间:2016-09-19 21:41:49

标签: javascript meteor angular pagination angular2-meteor

我正在运行这里找到的教程:

https://www.angular-meteor.com/tutorials/socially/angular2/search-sort-pagination-and-reactive-vars

我正在实现分页,但它引发了错误。控制台在第7行的parties-list.component.ts中引发错误。第7行的代码是:

 ng2-pagination.js:26Uncaught TypeError: core_1.NgModule is not a function

引发的FULL错误是:

{
  "name": "angular2-meteor-base",
  "private": true,
  "scripts": {
    "start": "meteor run",
    "test": "meteor test --driver-package practicalmeteor:mocha",
    "test:ci": "meteor test --once --driver-package dispatch:mocha-phantomjs"
  },
  "devDependencies": {
    "chai": "3.5.0",
    "chai-spies": "0.7.1"
  },
  "dependencies": {
    "@angular/common": "2.0.0-rc.4",
    "@angular/compiler": "2.0.0-rc.4",
    "@angular/core": "2.0.0-rc.4",
    "@angular/forms": "0.2.0",
    "@angular/platform-browser": "2.0.0-rc.4",
    "@angular/platform-browser-dynamic": "2.0.0-rc.4",
    "@angular/router": "3.0.0-alpha.8",
    "angular2-meteor": "0.6.2",
    "angular2-meteor-accounts-ui": "^0.6.1",
    "angular2-meteor-auto-bootstrap": "0.6.0",
    "angular2-meteor-polyfills": "0.1.1",
    "angular2-meteor-tests-polyfills": "0.0.2",
    "es6-shim": "0.35.1",
    "meteor-node-stubs": "0.2.3",
    "ng2-pagination": "https://registry.npmjs.org/ng2-pagination/-/ng2-pagination-0.4.1.tgz",
    "reflect-metadata": "0.1.3",
    "rxjs": "5.0.0-beta.6",
    "zone.js": "0.6.12"
  }
}

我想,也许ng2-pagination与我在流星内部运行但我不确定如何查找的角度版本不兼容。

我的package.js文件:

if

1 个答案:

答案 0 :(得分:2)

ng2-pagination软件包使用新的NgModule(在问题评论中由@StefanSvrkota强调的angular2 RC5中引入)自版本0.4.0以来,在09年的npm发布SEP-2016。

您将注意到此软件包独立于您正在使用的Angular2-meteor教程进行更新。

最简单的事情是包作者在其最新版本中引入了对等依赖(在angular2版本上)兼容性问题。

NgModule尚未使用时,您应该使用该软件包的早期版本:

$ npm uninstall --save ng2-pagination
$ npm install --save ng2-pagination@~0.3.0 # allow only patch version update

这应该会为您提供< 0.4.0版本,即目前为0.3.5