我已将我的项目更新为最后一个rc3版本的角度。
这是我的package.json:
"dependencies": {
"@angular/common": "2.0.0-rc.3",
"@angular/compiler": "2.0.0-rc.3",
"@angular/core": "2.0.0-rc.3",
"@angular/http": "2.0.0-rc.3",
"@angular/platform-browser": "2.0.0-rc.3",
"@angular/platform-browser-dynamic": "2.0.0-rc.3",
"@angular/router": "3.0.0-alpha.8",
"@angular/router-deprecated": "2.0.0-rc.2",
"@angular/upgrade": "2.0.0-rc.3",
"angular2-in-memory-web-api": "0.0.12",
"bootstrap": "^3.3.6",
"core-js": "^2.4.0",
"dragula": "^3.7.1",
"es6-shim": "^0.35.0",
"ng2-bootstrap": "^1.0.17",
"ng2-dragula": "^1.1.10",
"reflect-metadata": "^0.1.3",
"rxjs": "5.0.0-beta.6",
"systemjs": "0.19.28",
"zone.js": "^0.6.12"
},
"devDependencies": {
"browser-sync": "^2.13.0",
"del": "^2.2.1",
"gulp": "^3.9.1",
"gulp-rename": "^1.2.2",
"gulp-sourcemaps": "^1.6.0",
"gulp-typescript": "^2.13.4",
"run-sequence": "^1.2.1",
"typescript": "^1.8.2",
"typings": "^1.3.0"
}
我在main.ts中更改了这样的路线:
export const routes: RouterConfig = [
{path:'login', component: LoginComponent},
{path:'dashboard', component: ExchangeDasboardComponent},
{path:'', component: CreateAccountComponent},
{path:'exchange', component: ExchangeComponent}
];
bootstrap(IsdhComponent, [ HTTP_PROVIDERS, provideRouter(routes)]).catch(err => console.error(err));
当我启动应用程序时,我有这个错误:
browser_adapter.ts:74Error: Can't resolve all parameters for provideRouter: (?, ?).
at new BaseException (http://localhost:3000/lib/@angular/compiler/src/facade/exceptions.js:20:23)
at CompileMetadataResolver.getDependenciesMetadata (http://localhost:3000/lib/@angular/compiler/src/metadata_resolver.js:292:19)
at CompileMetadataResolver.getTypeMetadata (http://localhost:3000/lib/@angular/compiler/src/metadata_resolver.js:173:26)
at eval (http://localhost:3000/lib/@angular/compiler/src/metadata_resolver.js:327:30)
at Array.map (native)
at CompileMetadataResolver.getProvidersMetadata (http://localhost:3000/lib/@angular/compiler/src/metadata_resolver.js:315:26)
at CompileMetadataResolver.getDirectiveMetadata (http://localhost:3000/lib/@angular/compiler/src/metadata_resolver.js:124:34)
at RuntimeCompiler.resolveComponent (http://localhost:3000/lib/@angular/compiler/src/runtime_compiler.js:38:47)
at eval (http://localhost:3000/lib/@angular/core/src/application_ref.js:147:37)
at eval (http://localhost:3000/lib/@angular/core/src/application_ref.js:344:26)
我做错了什么?我已按照此文档:https://angular.io/docs/ts/latest/guide/router.html
答案 0 :(得分:2)
我的不好,
在迁移过程中,我将它放在我的根组件中:
providers : [provideRouter]
我已删除它,并且它正常工作。