I've got a nav
component which is a menu that handles a bit of route switching, the problem I have is that I can't seem to render the content of the routes because I don't have a router-outlet
within the nav
component template.
Instead I would like to render the content of the route in my main app component core
, but how do I tell angular to use the router-outlet
in my core
component rather than in my nav
component?
Since my [routerLink]
is inside this template:
nav.component.html:
<nav class="nav-wrapper" [class.is-toggled]="isToggled" [class.is-hidden]="!isToggled">
<ul class="nav-links">
<li class="nav-link" *ngFor="#link of links">
<a [routerLink]="link.href">
<div class="label-wrapper">{{link.label}}</div>
<div class="icon-wrapper"><i class="{{link.icon}}"></i></div>
</a>
</li>
</ul>
</nav>
It doesn't want to render the route into the core
component:
core.component.html:
<!-- The menu -->
<nav-list></nav-list>
<!-- The router-outlet which should render the videos component -->
<router-outlet></router-outlet>
videos.component.html:
<h1>My videos</h1>
<!-- This should render the child views of the videos component -->
<router-outlet></router-outlet>
list.videos.component.html:
<h1>Videos list</h1>
So as you can see I want the bottom snippet to be rendered into the middle snippet which is then rendered at the top, inside the core
component.
How can I do this?
The bottom line is that I DO NOT want to have a router-outlet
in the nav
component.