How to define default route with parameters in Angular Component Router?

后端 未结 2 1758
-上瘾入骨i
-上瘾入骨i 2021-01-20 22:18

I want to have a default route in my sub-component (set with useAsDefault: true) and to have parameters automatically passed to it. I cannot find anywhere in do

2条回答
  •  孤街浪徒
    2021-01-20 23:17

    As far as I know this is not supported. You can have a route with and without the parameter and then in the GroupDefault component just navigate to Group

    $routeConfig = [
        { path: '/group', component: 'employeeListComponentDefault', name: 'GroupDefault', useAsDefault: true}
    
        { path: '/:group/:filter', component: 'employeeListComponent', name: 'Group'},
        { path: '/details/:employeeId/...', component: 'profileComponent', name: 'EmployeeProfile'}
    ]
    

    See also

    • Optional Parameters While Routing angular2
    • Angular 2 optional route parameter

提交回复
热议问题