以角度2设置路由器queryParams不起作用

时间:2017-06-19 02:47:22

标签: javascript angular router angular-routing

我尝试将Arry传递给路由器queryParams,但每次都不起作用。
这是我的代码:

clickOrg(event) {
  if (this.idLists[this.idLists.length - 1] != event.id) {
    this.idLists.push(event.id);
    this.type = event.type;
    console.log (this.idLists)
    this.router.navigate(['userManage'], { queryParams: {idLists:this.idLists,type:this.type} });
  }
}

日志(this.idLists)的结果是对的 enter image description here

但路由器的queryParams没有更新enter image description here

任何帮助都将不胜感激。

1 个答案:

答案 0 :(得分:0)

我对queryParams也有问题。他们工作了一段时间。但突然停了下来。

我已经为此做了临时解决方案。

this.router.navigateByUrl(`${this.env.getLoginUrl()}?returnUrl=${state.url}`);