I am working with routing and navigation. I am using [routerLinkActive]="['active']"
to make a link active. It works fine when I navigate to other route.
But when current page is refreshed, 'routerLinkActive' is not working and no link is active. I need to select that link to make it active again. Is there any way to make that link active once page is reloaded.
sample:
app-routing.ts
{
path: 'home',
children: [
{path: 'product', component: ProductComponent},
{path: 'dualList', component: DualListComponent},
{path: 'member', component: MemberComponent},
{path: '', component: HomeComponent}
]
},
{path: 'about', component: AboutComponent}
home.component.html
<a [routerLink] = "['/home', 'product']" routerLinkActive="active" [routerLinkActiveOptions]="{ exact: true }">Product</a>
<a [routerLink] = "['/home', 'dualList']" routerLinkActive="active">Dual List</a>
<a style="padding-left: 20px" [routerLink] = "['/home', 'member']" routerLinkActive="active">Member</a>
Any help would be appreciated.