我想要一个未解析的当前路线版本
ie:dashboard/:id
我不希望id
部分显示为数字。
这就是我的
"dependencies": {
"@angular/common": "~2.1.0",
"@angular/compiler": "~2.1.0",
"@angular/core": "~2.1.0",
"@angular/forms": "~2.1.0",
"@angular/http": "~2.1.0",
"@angular/platform-browser": "~2.1.0",
"@angular/platform-browser-dynamic": "~2.1.0",
"@angular/router": "~3.1.0",
"@ngrx/core": "^1.2.0",
"@ngrx/store": "^2.2.1",
"core-js": "^2.4.1",
"ng2-breadcrumb": "^0.4.1",
"rxjs": "5.0.0-beta.12",
"ts-helpers": "^1.1.1",
"zone.js": "^0.6.23"
},
尝试浏览Router
和ActivatedRoute
并找不到它。
constructor(
private activatedRoute: ActivatedRoute,
private router: Router
) {
console.log(this.activatedRoute.routeConfig.path)
}
Error in ./AppComponent class AppComponent - inline template:54:2 caused by: Cannot read property 'path' of null