I'm working on a little test project in angular and I want to include a side navigation using angular router outlet. I want there to be two links:
<a class="nav-link text-white" [routerLink]='["/link/to/one"]' routerLinkActive="aLink" [routerLinkActiveOptions]="{ exact: true }">Component 1</a>
<a class="nav-link text-white" [routerLink]='["/another/link/to/component"]' routerLinkActive="aLink" [routerLinkActiveOptions]="{ exact: true }">Component 2</a>
There are a few sub pages that can be navigated to from one of the components. But they don't need to show up as a router link.
So the structure of my site can be for example:
|-Comopnent 1
|
|-Component 2
|- Component 3
|- Component 4
So I want the user to be able to navigate to Component2 via the router links. From this component the user can be redirected via code to component 3 and 4. But I dont want them to have extra router links, I want that there is still component2 highlighted in the navigation menu.
In my app.module.ts I declared the routes pretty basically:
RouterModule.forRoot([
{ path: '', component: HomeComponent, pathMatch: 'full'},
{ path: '/link/to/one', component: Component1 },
{ path: '/another/link/to/component', component: Component2 },
])
How can I call Component3 & 4 from Component2, and let the router highlight Component2 in the navigation bar?
Regards