-
Notifications
You must be signed in to change notification settings - Fork 27.1k
Description
I'm submitting a ... (check one with "x")
[x] bug report
[ ] feature request
[ ] support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question
Current behavior
Aux-Routes are not found when using two levels of "default routes" (with path:'').
This config works:
RouterModule.forRoot([
{
path: 'tasks', component: TasksComponent, //container-component has two outlets!
children: [
{ path: '', component:TaskListComponent },
{ path: 'overview/:id', component: TasksComponent, outlet: 'right' },
]
}
],I can open the Tasks-overview by doing:
http://localhost:4200/tasks/(right:overview/3)
See this plnkr and click "to list", "open aux"
As I want to extract the whole Tasks-Functionality into a TasksModule I need to be able to do something like this:
RouterModule.forRoot([
{
path: 'tasks', : children: [ // this one would be in main module
//this is defined in the TasksModule:
{ path: '', component: TasksComponent, //container-component has two outlets!
children: [
{ path: '', component:TaskListComponent },
{ path: 'overview/:id', component: TasksComponent, outlet: 'right' },
]
}
],I would assume both configs are equivalent, and all of the "normal" routing works perfectly fine. But now the link above http://localhost:4200/tasks/(right:overview/3) leads to:
Uncaught (in promise): Error: Cannot match any routes: 'tasks'
See this plnkr: http://plnkr.co/edit/xd77Mkpqfq6U9tKM4USU?p=preview
Expected/desired behavior
Aux-Routes should also work with empty-path parents
Reproduction of the problem
Working version: http://plnkr.co/edit/Twx4hXQ0TLfHfrYSe4MO?p=preview
Non-working version: http://plnkr.co/edit/xd77Mkpqfq6U9tKM4USU?p=preview
What is the expected behavior?
Both versions of route definition should lead to the same behavior
What is the motivation / use case for changing the behavior?
With the current implementation it is impossible to create an encapsulated Config / Module for the tasks behaviour and include it under a certain path into the main config e.g. "myTasks".
/cc @vsavkin
Please tell us about your environment:
- Angular version: 2.0.0-rc.5
- Browser: [all ]
- Language: [TS ]