【发布时间】:2018-10-19 11:47:34
【问题描述】:
我有以下路由配置。如何从项目编辑组件内部访问父路由中看到的 :projectId?
{
path: 'folders/:folderId/projects/:projectId/s',
component: ProjectDetailComponent,
canActivate: [AuthGuardService],
children: [
{
path: 'edit',
component: ProjectEditComponent,
canActivate: [AuthGuardService],
},
{
path: 'i',
component: IssuesListComponent,
canActivate: [AuthGuardService],
},
],
},
我之前在没有子路由时使用过这种方法:
this.activatedRoute.params.subscribe((urlParameters) => {
this.project_id = urlParameters['projectId'];
});
不幸的是,这不再有效。
【问题讨论】:
-
详细说明您的问题。
-
嘿@SunilSingh - 我已经更新了这个问题。希望这更准确,更清晰。
标签: angular angular-routing routeparams