angular: angular2 router dose not work when “loadChildren” loading modules
I have a router definition like this:
const routes: Routes = [
{
"path": "member",
"loadChildren": "app/member/member.module#MemberModule"
},
{
"path": "",
"loadChildren": "app/video/video.module#VideoModule"
},
{
"path": "**",
"redirectTo": ""
}
]
MemberRouter definition like this:
const routes: Routes = [
{
"path": "order",
"component": MemberComponent,
"loadChildren": "app/member/order/order.module#OrderModule"
},
{
"path": "",
"component": MemberComponent,
"loadChildren": "app/member/index/index.module#IndexModule"
}
]
OrderRouter definition like this:
const routes: Routes = [
{
"path": "list",
"outlet": "member",
"component": OrderComponent,
"loadChildren": "app/member/order/list/list.module#ListModule"
},
{
"path": "",
"outlet": "member",
"component": OrderComponent
}
]`
ListRouter definition like this:
`const routes: Routes = [
{
"path": "",
"outlet": "order",
"component": ListComponent
}
]
It dose not work at “/member/order/list”
It is working at “/member/order”
“OrderRouter” rules can not be matched when “MemberRouter” is lazy loaded
“loadChildren” dose not work when nested
Please help me solve, thank you!
Plunker Demo Click “product/detail/item” button dose no work.
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 4
- Comments: 19 (3 by maintainers)
I’ve fixed the issue…you just add ‘:’ before the ‘" in path value like ':’… example like { path: ‘😗*’, loadChildren: ‘app/components/pagenotfound/pagenotfound.module#PagenotfoundComponentModule’, “pathMatch”: “full” }
For me, I also get same error and I’ve fixed it 😃 only add ./ before which modules want to link at root module app! I hope solved your problem 👍