我目前嘗試在我的應用程序中獲得好的路線,但在我目前的實施中,我必須獲取並檢查我的路線訂閱中的所有參數。有沒有什麼辦法可以從我可以改變路線的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