256x256
我有这个方法所以我想要的是当用户返回上一页时,清除queryParams。任何建议我怎么能这样做?
答案 0 :(得分:0)
使用三元:
returnToPreviousPage(){
this.router.navigate([this.returnUrl], { queryParams: yourBoolean ? { customerId: this.caId } : null });
}
yourBoolean
可以是任何条件
<强>更新强>
returnToPreviousPage(){
this.router.navigate([this.returnUrl], yourBoolean ? { queryParams: { customerId: this.caId } } : null);
}