//EDIT 2: As of Angular 4, it seems like this has been fixed/revised. Currently I am able to define named outles 'inside' of an unnamed outlet
//EDIT:
As @Michelangelo pointed out, this seems to be a 'design choice'/bug related to the Angular Router. As a workaround I am dynamically injecting the user-edit.component into user-list with the current user.
See https://angular.io/docs/ts/latest/cookbook/dynamic-component-loader.html for more information on that.
I have the following setup:
{
path: 'admin',
canActivate: [ AuthGuard, PermissionGuard ],
children: [
{
path: '',
component: UserListComponent,
resolve: {
users: UsersResolver
}
},
{
path: ':id',
component: UserEditComponent,
outlet: 'admin'
}
]
}
The outlet looks like:
<router-outlet name="admin"></router-outlet>
And I try to navigate with:
this.router.navigate(['/admin', {outlets: {'admin': [user.id]}}]);
If I try to navigate to that route without specifying an outlet, it works fine. But as soon as I try to use a named router outlet it breaks.
Error: Cannot find the outlet admin to load 'UserEditComponent'