I am trying to navigate to a nested auxiliary route, and I keep getting the error:
ERROR Error: Uncaught (in promise):
Error: Cannot match any routes. URL Segment: 'sign-in'
The URL I am trying to navigate to:
http://localhost:4200/(modalcontainer:modals//modalview:sign-in)
My router config for the route looks like this:
{
path: 'modals',
component: ModalsComponent,
outlet: 'modalcontainer',
children: [
{
path: 'register',
outlet: 'modalview',
component: ModalRegisterComponent
},
{
path: 'sign-in',
outlet: 'modalview',
component: ModalSigninComponent
}
]
}
So there are 2 router-outlets
which are modalcontainer
and modalview
. The latter is inside the template of ModalsComponent
.
AppComponent
<router-outlet></router-outlet>
<router-outlet name="modalcontainer"></router-outlet>
ModalsComponent
<div class="overlay" (click)="close($event)">
<router-outlet name="modalview"></router-outlet>
</div>
The modalcontainer
populates ok, but as soon as I try to populate the modalview
outlet, it errors.
Ways of navigating I have tried are:
[routerLink]="[{outlets: {'modalcontainer': ['modals'], 'modalview': ['register']}}]"
[routerLink]="[{outlets: {'modalcontainer': ['modals'], 'modalview': ['modals', 'register']}}]"
[routerLink]="['modals', {outlets: {'modalview': ['register']}}]"
- Directly typing into the address bar
http://localhost:4200/(modals:modals//modal:sign-in)
this.router.navigate([{outlets: {'modalcontainer': ['modals'], 'modalview': ['register']}}]);
this.router.navigateByUrl('/(modals:modals//modal:sign-in)');
Is it something in my configuration or the way I am accessing the URLs? Or is this a bug?