我正在尝试使链接在url中设置查询字符串参数…
在我看来,我正在做:
<a (click)="selectPage(123)">123</a>
和在我的组件:
selectPage(page: number) {
this.router.navigate([], { relativeTo: this.route, queryParams: { 'page': page}, queryParamsHandling: 'merge', skipLocationChange: true});
}
我点击链接,selectPage函数触发,但是浏览器中的url没有页面参数显示…
你必须省略skipLocationChange
属性,然后它将工作。