Hello I am trying to use child routing, but it does not work as intended.
My angular 5 structure:
In this scenario, the top-nav contains links to load submodules and sub-nav has links to update the submodule's contents.
The app module (and app component) contains a top navbar to navigate to different submodules and the app component template could look like this
<top-navbar></top-navbar>
<router-outlet></router-outlet>
But here is the complexity. I need my submodules to have similar layout with a second level nav bar and their own router outlet to load their own components.
<sub-navbar></sub-navbar>
<router-outlet name='sub'></router-outlet>
My app.module.ts
RouterModule.forRoot([
{
path: 'career', component: CareerComponent,
children: [
{ path: 'roles', component: rolesComponent, outlet: 'sub' }
]
}
])
My HTML file, I am using the following format on my nav buttons:
[routerLink]="[{ outlets: { sub: ['roles'] } }]"
I also have tried the following (this does nothing, I click on Roles button and nothing happens):
[routerLink]="['/roles']"
On top menu I click on Career from the nav. Now my url shows as mywebsite.com/career
now from here I have a career page with my side menu, one of the button is Roles. This should change the partial view of the page. The component is loaded right, the problem is that the url format is wrong.
Expected URL:
mywebsite.com/career/roles
How it displays(WRONG) :
mywebsite.com/career/(sub:roles)
