Setting router queryParams in angular 2 do not work

孤街醉人 提交于 2019-12-12 04:57:52

问题


I try to pass an Arry to router queryParams,but it doesn't work every time.
this is my code :

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} });
  }
}

the result of the log (this.idLists) is right

but the router's queryParams didn't update

Any help would be appreciated.


回答1:


I'm also have a problem with queryParams.They were working for a few time. But suddenly stopped.

I have made temporary solution for that.

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


来源:https://stackoverflow.com/questions/44621581/setting-router-queryparams-in-angular-2-do-not-work

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!