如何在路由模块中获取路由参数?

时间:2021-01-06 14:56:00

标签: angular angular6 angular-routing angular11

如何在同一个路由模块中获取 id 的值?

const routes: Routes = [
  {
    path: 'departments/:id',
    component: HrComponent /* (id==='hr')?HrComponent:ITComponent;*/
  }];
@NgModule({
    imports: [RouterModule.forChild(routes)],
    exports: [RouterModule]
})
export class DynformRoutingModule { }

0 个答案:

没有答案