0
votes

Mac OS X

Dependencies:

  "dependencies": {
    "@angular/common": "2.0.0-rc.2",
    "@angular/compiler": "2.0.0-rc.2",
    "@angular/core": "2.0.0-rc.2",
    "@angular/http": "2.0.0-rc.2",
    "@angular/platform-browser": "2.0.0-rc.2",
    "@angular/platform-browser-dynamic": "2.0.0-rc.2",
    "@angular/router": "3.0.0-alpha.7",
    "es6-shim": "^0.35.0",
    "reflect-metadata": "0.1.3",
    "rxjs": "5.0.0-beta.6",
    "semantic-ui": "^2.1.8",
    "systemjs": "0.19.31",
    "zone.js": "^0.6.12"
  }

Code:

import {provideRouter, RouterConfig} from "@angular/router";

export const routes: RouterConfig = [
  { path: 'crisis-center', component: CrisisCenterComponent },
  { path: 'heroes', component: HeroListComponent },
  { path: 'hero/:id', component: HeroDetailComponent }
];

export const APP_ROUTER_PROVIDERS = [
  provideRouter(routes)
];

Getting Error:

@angular/router/index has no exported member provideRouter and RouterConfig.

What I tried:

  1. Went to @angular/router/index file:
/**
 * @module
 * @description
 * Maps application URLs into application states, to support deep-linking and navigation.
 */
export { ROUTER_DIRECTIVES } from './src/directives/router_directives';
export { RouterLink } from './src/directives/router_link';
export { RouterOutlet } from './src/directives/router_outlet';
export { CanDeactivate, OnActivate } from './src/interfaces';
export { Routes } from './src/metadata/decorators';
export { Route } from './src/metadata/metadata';
export { Router, RouterOutletMap } from './src/router';
export { ROUTER_PROVIDERS } from './src/router_providers';
export { DefaultRouterUrlSerializer, RouterUrlSerializer } from './src/router_url_serializer';
export { RouteSegment, RouteTree, Tree, UrlSegment, UrlTree } from './src/segments';

And there was no export for provideRouter and RouterConfig.

  1. Went through provideRouter and RouterConfig not found in new @angular/router 3.0.0-alpha.3^ and tried after updating SystemJS version from 0.19.27 to 0.19.31 but nothing seems to work.
1
Have you tried with RC.3. The changelog doesn't mention it but the router was integrated into the angular repository recently. - Günter Zöchbauer
Hi Gunter, Thanks for your response. I didn't try the RC.3 but I deleted npm_modules and reinstalled it. Now provideRouter and routerConfig are showing in the export list of @angular/router. - Niraj

1 Answers

2
votes

it looks like your npm module is not updated try by first uninstalling "@angular/router" and installing it again.