Meteor + Angular2 - 找不到名称'Router'

时间:2017-07-24 10:01:20

标签: angular meteor ionic2 router

我正在尝试将Meteor和Angular2混合到一个应用程序中使用本教程enter link description here

一切都没有流星,但当它与流星一起运行时我遇到了2个错误:

  

找不到名称'路由器'。

并且

  

找不到名称'ActivatedRouteSnapshot'

问题是我做了“meteor npm install --save @ angular / router”它已安装但没有改变:/

我的package.json

    {
    "name": "meteor-test",
    "private": true,
    "scripts": {
        "start": "meteor run",
        "desktop": "meteor-desktop -p 4000"
    },
    "dependencies": {
        "@angular/common": "4.2.6",
        "@angular/compiler": "4.2.6",
        "@angular/compiler-cli": "4.2.6",
        "@angular/core": "4.2.6",
        "@angular/forms": "4.2.6",
        "@angular/http": "4.2.6",
        "@angular/platform-browser": "4.2.6",
        "@angular/platform-browser-dynamic": "4.2.6",
        "@angular/platform-server": "4.2.6",
        "@angular/router": "4.3.1",
        "@ionic/storage": "^2.0.1",
        "angular2-cookie": "^1.2.6",
        "babel-runtime": "^6.20.0",
        "ionic-angular": "^3.5.0",
        "ionic-native": "^2.9.0",
        "ionicons": "^3.0.0",
        "meteor-node-stubs": "~0.2.4",
        "meteor-rxjs": "^0.4.7",
        "reflect-metadata": "^0.1.10",
        "rxjs": "^5.4.2",
        "zone.js": "^0.8.12"
    },
    "devDependencies": {
        "@types/meteor": "^1.4.2",
        "@types/meteor-accounts-phone": "0.0.5",
        "@types/underscore": "^1.8.1",
        "meteor-desktop": "^0.8.0",
        "meteor-typings": "^1.4.1"
    }
}

2 个答案:

答案 0 :(得分:1)

我在tsconfig.json文件中找到了解决方案!

您必须删除此行:

"allowSyntheticDefaultImports": true,

答案 1 :(得分:0)

我认为这些是你应该导入的类:

import {
  RouterModule,
  Routes,
  ActivatedRoute
} from '@angular/router';