在 angular 2 中设置路由器 queryParams 不起作用 [英] Setting router queryParams in angular 2 do not work

查看:36
本文介绍了在 angular 2 中设置路由器 queryParams 不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试将 Arry 传递给路由器 queryParams,但并非每次都有效.
这是我的代码:

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

日志结果(this.idLists)是对的

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

但是路由器的 queryParams 没有更新

but the router's queryParams didn't update

任何帮助将不胜感激.

推荐答案

我也遇到了 queryParams 的问题.他们已经工作了一段时间.但突然停了下来.

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

这篇关于在 angular 2 中设置路由器 queryParams 不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆