我似乎在Angular 2的新路由器3.0.0-alpha.8中遇到问题。Angular 2路由器3.0.0嵌套路由编译
长话短说,我app.routes.ts是
export const routes: RouterConfig = [
{ path: '', component: HomeComponent, canActivate: [AuthGuard] },
{ path: 'login', component: LoginComponent },
...SectionARoutes,
...SectionBRoutes
];
export const APP_ROUTER_PROVIDERS = [
provideRouter(routes),
AUTH_PROVIDERS
];
它负载部分路由就好这就是:
export const SectionARoutes: RouterConfig = [
{ path: 'a', component: SectionAComponent, canActivate: [AuthGuard] },
{ path: 'a-more', component: SectionAMoreComponent, canActivate: [AuthGuard] },
...SectionAMoreRoutes
];
但它无法加载嵌套SectionAMoreRoutes。当我说加载失败,我的意思是我得到的错误是:
zone.js:463 Error: Uncaught (in promise): Error: Error: XHR error (404 Not Found)
loading http://localhost:4200/app/+a/+a-more/a-more.routes.ts.js(…)
看来,我的打字稿是没有得到编译成JS当路由嵌套。我很想对如何继续,因为我是相当丢失:(
感谢!
EXTRA信息任何帮助或想法: 我main.ts有:
bootstrap(AppComponent, [
...
APP_ROUTER_PROVIDERS,
]
中─ A-多个路线是这样的:
export const SectionARoutes: RouterConfig = [
{ path: '', component: SectionAMoreListComponent, canActivate: [AuthGuard] },
{ path: '/:id', component: SectionAMoreDetailComponent, canActivate: [AuthGuard] }
];
TLDR:为什么我的嵌套航线角2和路由器编译3.0.0
你有什么作为你的基础href在index.html中? –