这是我在package.json中的配置:
"dependencies": {
"@angular/common": "2.0.0-rc.4",
"@angular/compiler": "2.0.0-rc.4",
"@angular/core": "2.0.0-rc.4",
"@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/platform-server": "2.0.0-rc.4",
"@angular/router": "3.0.0-beta.1",
"angular2-universal": "^0.104.5",
"aspnet-prerendering": "^1.0.2",
"css": "^2.2.1",
"es6-shim": "^0.35.1",
"isomorphic-fetch": "^2.2.1",
"preboot": "^2.0.10",
"rxjs": "5.0.0-beta.6",
"webpack-externals-plugin": "^1.0.0",
"zone.js": "^0.6.12"
}
这是我的代码:
bootstrap(App, [
...HTTP_PROVIDERS,
FormBuilder,
AuthGuard,
AuthenticationService,
provideRouter(routes)
]);
我收到错误“只允许提供者和类型的实例,得到:[object Object]”。那是什么意思?我的错误在哪里?
错误似乎在provideRouter(路由)部分。
export const routes: RouterConfig = [
{ path: 'login', component: LoginComponent },
{ path: '', component: HomeComponent, canActivate: [AuthGuard] },
{ path: 'counter', component: Counter },
{ path: 'fetch-data', component: FetchData },
{ path: '**', redirectTo: '' }
];
这是路线的定义。