I have the following plunker, which does not work. In order to get it to work I can comment out...
RouterModule.forRoot([
{
path: "",
component: TestComponent,
children: [
// {
// path:"",
// outlet: "other",
// component: TestComponent
// }
]
}
])
If I don't do that I get...
EXCEPTION: Uncaught (in promise): Error: Cannot match any routes. URL Segment: ''
Error: Cannot match any routes. URL Segment: ''
How do I add a child route?
The router will stop after the first path is matched, which it does in the parent route. I've found it best to use a separate routing module for each router outlet. That being said, you get an ugly
(other:route)
for the auxilary route in your url. Admittedly, I have found some limitations to using auxiliary routes.You should give different path names until you use
pathMatch: 'full'
. Forked.More about the subject in Angular Router: Empty Paths, Componentless Routes, and Redirects.