I\'m looking for a solution with Angular 2 for the scenario explained below:
In this scenario, the top-nav contains links to load submodules and sub-nav has
The html page will look like this.
Main Page
Sub Module Page
on clicking navigation in top-nav bar the main route outlet will route respectively.
while clicking on sub-navbar the router-outlet [sub] will route respectively.
HTML is fine, the trick will came at writing app.routing
app.routing.ts
const appRoutes: Routes = [
{
path: 'login',
component: LoginComponent
},
{ path: 'home',
component: homeComponent,
children: [
{
path: 'module1',
component: module1Component,
children: [
{
path: 'submodule11',
component: submodule11Component,
},
{
path: '',
redirectTo: 'submodule11',
pathMatch: 'full'
}
]
},
{
path: 'module2',
component: module2omponent,
children: [
{
path: 'submodule21',
component: submodule21Component,
},
{
path: '',
redirectTo: 'submodule21',
pathMatch: 'full'
}
]
}
]
},
{
path: 'about',
component: aboutComponent
}
]
Hope it will help you.
More details https://angular.io/guide/router