Reputation: 3153
I have routing setup for my application with a . Everything is fine but one of my views loads a side bar which I want to use a different . When I try to add additional routing to the component I get 'Child routes are not allowed for "xxx" use "..." on the parent's route path.
Has anybody added multiple layers of routing that can help? thanks!
Upvotes: 2
Views: 971
Reputation: 39248
Parent routes use a special ...
syntax
//parent route
@RouteConfig([
new Route({path: '/', component: DemoPage, name: 'Home'}),
new Route({path: '/demo/...', component: DemoPage, name: 'Demo'})
})
//child routes defined in separate route config
@RouteConfig([
new Route({ path: '/spreadsheet', component: Spreadsheet, name: 'Spreadsheet' })
//etc
])
I have a tutorial here: http://www.syntaxsuccess.com/viewarticle/routing-in-angular-2.0
You can also see nested routes in action here:
http://www.syntaxsuccess.com/angular-2-samples/#/demo/spreadsheet
The left nav is using child routes.
Upvotes: 4