我目前尝试在我的应用程序中获得好的路线,但在我目前的实施中,我必须获取并检查我的路线订阅中的所有参数。有没有什么办法可以从我可以改变路线的employees
或departments
'静态'参数,而不是检查每个可能性的所有参数值?
如果我的任何路线不合逻辑或者错误,我也可以改进。Angular2 Hot从网址获取所有参数?
export const EmployeeManagementRoutes: RouterConfig = [
{
path: 'employee-management',
component: EmployeeManagementComponent,
children: [
//display all employees
{
path: '',
//is there any way to make this redirict relative to the component the router is for?
redirectTo: '/employee-management/employees/department/all',
pathMatch: 'full'
},
//display all employees from a specific department
{
path: 'employees//department/:department',
component: EmployeeManagementTableComponent
},
//open dialog for deleting or creating a new employee or
if option is 'show' and id is not undefined show a specific employee
{
path: 'employees/action/:option/:id',
component: EmployeeManagementTableComponent
},
//display all departments
{
path: 'departments',
component: EmployeeManagementTableComponent
},
//open dialog for deleting or creating a new department
{
path: 'departments/action/:option',
component: EmployeeManagementTableComponent
},
]
}
];
谢谢。那正是我所寻找的。 – moessi774