由于我不熟悉FE dev,Angular的URL处理并不容易。 所以我想问你几点。
-----------------------------------------------------
/ <-- main page
/company/{companyId} <-- main page redirected to.
-----------------------------------------------------
/employee/{empId}/profile
/employee/{empId}/worklog
-----------------------------------------------------
/dept/{deptId}/empList
/dept/{deptId}/issueList
-----------------------------------------------------
one url may looks like
/company/{facebook}/employee/{james}/profile
(行号不是实际值,但问题描述..)
// main.ts
01 export const MainRoutes: RouterConfig = [
02 { path: '', redirectTo:'company/facebook' component: CompanyComponent},
03 { path: 'company/:companyId', component: CompanyComponent}
04 ];
// company.ts
05 export const CompanyRoutes: RouterConfig = [
06 { path: 'employee/:empId', component: EmployeeComponent},
07 { path: 'dept/:deptId', component: DeptComponent}
08 ];
// employee.ts
09 export const EmployeeRoutes: RouterConfig = [
10 { path: 'profile', component: EmployeeProfile},
11 { path: 'worklog', component: EmployeeWorklog}
12 ];
// dept.ts
13 export const DeptRoutes: RouterConfig = [
14 { path: 'empList', component: EmpListComponent},
15 { path: 'issueList', component: IssueListComponent}
16 ];
// employee.ts (path from parent) 09 export const EmployeeRoutes: RouterConfig = [ 10 { path: 'profile', component: EmployeeProfile}, 11 { path: 'worklog', component: EmployeeWorklog} 12 ]; // employee.ts (path from home) 09 export const EmployeeRoutes: RouterConfig = [ 10 { path: 'company/:companyId/employee:empId/profile', component: EmployeeProfile}, 11 { path: 'company/:companyId/employee:empId/worklog', component: EmployeeWorklog} 12 ];
任何方式让个人路线注册?像春天&#39; http://www.journaldev.com/3358/spring-requestmapping-requestparam-pathvariable-example&#39;
我是否必须致电&#39; provideRouter()&#39;在这样的所有路线的单一地方?
http://plnkr.co/edit/?p=preview
import { provideRouter, RouterConfig } from '@angular/router'; import { CrisisCenterRoutes } from './crisis-center/crisis-center.routes'; import { HeroesRoutes } from './heroes/heroes.routes'; import { LoginRoutes, AUTH_PROVIDERS } from './login.routes'; import { CanDeactivateGuard } from './interfaces'; export const routes: RouterConfig = [ ...HeroesRoutes, ...LoginRoutes, ...CrisisCenterRoutes ]; export const APP_ROUTER_PROVIDERS = [ provideRouter(routes), AUTH_PROVIDERS, CanDeactivateGuard ];
子网址组件必须记住Upper组件&#39;参数
我知道这个问题也是......没有说明。但我完全陷入困惑。
的问候。 击昏。
答案 0 :(得分:1)