Mac OS X
依赖关系:
"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"
}
代码:
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)
];
获取错误:
@angular/router/index has no exported member provideRouter and RouterConfig.
我尝试了什么:
/**
* @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';
并且没有exportRouter和RouterConfig的导出。
答案 0 :(得分:2)
看起来你的npm模块没有更新尝试首先卸载“@ angular / router”并重新安装。