我正在使用角度材料导航选项卡:
<nav mat-tab-nav-bar>
<a mat-tab-link
[routerLink]="'firstRoute'"
[queryParams]="{param1: value1, param2: value2}"
routerLinkActive #rla1="routerLinkActive"
[active]="rla1.isActive">
Import
</a>
<a mat-tab-link
[routerLink]="'secondRoute'"
[queryParams]="{param1: value1, param2: value2}"
routerLinkActive #rla2="routerLinkActive"
[active]="rla2.isActive">
Database
</a>
</nav>
一切正常,直到我更改查询参数值为止:
changeQueryParams() {
const params = {
param1: 'newValue1',
param2: 'newValue2'
};
this.router.navigate([], { relativeTo: this.route, queryParams: params });
}
每次我调用此方法时,当前选项卡都会丢失激活标记(文本下方的蓝色边框)。我在这里错过了什么?