1
votes

I am trying to make routing in my angular2 application. I just tried to follow this link.

But in the app.routing.ts in line:

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

It complains with:

node_modules/@angular/router/index"' has no exported member 'Routes'.

and

node_modules/@angular/router/index"' has no exported member 'RouterModule'.

Here is my package.json file:

"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/http": "2.0.0-rc.4",
    "@angular/platform-browser": "2.0.0-rc.4",
    "@angular/platform-browser-dynamic": "2.0.0-rc.4",
    "@angular/router": "^3.0.0-alpha.7",
    "es6-shim": "0.35.1",
    "reflect-metadata": "0.1.3",
    "rxjs": "5.0.0-beta.6",
    "systemjs": "0.19.26",
    "zone.js": "0.6.12"
  },

As you see, i am using "@angular/router": "^3.0.0-alpha.7",, but it does not help me.

2

2 Answers

2
votes

Routes is only an import for the new version of the router. If you wish to use it, you must update your project to the new RC.5 version of the router.

edit: also is you navigate to your node_modules then @angular/router/index.d.ts then you will be able to see the available imports for your router version.

1
votes

you are using older version of router . the newer version is "@angular/router": "3.0.0-rc.1" as seen in change log

update your app to angular rc5 as well.