在通过浏览器返回更改路线时,我正在激活上一个选项卡。 但是,只要单击某处,它就可以正常工作。
.html
<a [routerLink]="['/home']" [routerLinkActive]="['active']"
class="navigation-link" >
</a>
<a [routerLink]="['/products']" [routerLinkActive]="['active']"
class="navigation-link" >
</a>
.module.ts
{
path: '',
component: Component,
canActivate: [AuthGuard],
children: [
{
path: '',
redirectTo: '/home',
pathMatch: 'full'
},
{
path: 'home',
loadChildren: './my-modules/home.module#HomeModule'
},
{
path: 'products',
loadChildren: './my-modules/products.module#ProductsModule'
}
]
}
If i click somewhere in UI it shows correct active tab