问题
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