I'm having trouble when using named router outlets on Angular2 2.1.2.
I'm getting the error:
Cannot find the outlet XOutlet to load 'YComponent'
The error is pretty clear itself, but I'm stuck and can't find a way around it.
The HTML looks like this:
<router-outlet name="XOutlet"></router-outlet>
<!-- Main content -->
<div class="content-wrapper">
<router-outlet></router-outlet>
</div>
The Routes file:
{
path: 'other',
component: OtherComponent,
children: [
{
path: 'list',
component: YComponent,
outlet: 'XOutlet'
}
]
},
The link
<a [routerLink]="['other', {outlets: {'XOutlet': 'list'}}]"><span>Other</span></a>
What am I missing?
Thanks
EDIT: Based on the comment by Oleg Barinov, the HTML provided is part of the base HTML, not from the OtherComponent HTML.
Use <a [routerLink]="['/', {outlets: {'XOutlet': 'list'}}]"><span>Other</span></a> for this kind of implementation.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With