Angular2 如何在我的网址中传递问号和一些单词 [英] Angular2 how can i pass a question mark and some words in my url

查看:17
本文介绍了Angular2 如何在我的网址中传递问号和一些单词的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,我正在尝试向导航 url 添加一些字符串参数,如下所示this.router.navigate(['/merchant/setpassword?acc='+response.infoCode]);
但是当我使用它时,它会将我重定向到

hello i am trying to add some string parameters to the navigation url like this this.router.navigate(['/merchant/setpassword?acc='+response.infoCode]);
but when i am using this is redirecting me to

/merchant/setpassword%3Facc%3DeyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJtZXppYW4iLCJjb3VudHJ5IjoiOTYiLCJjcmVhdGVkIjoxNTAwMzExODk2MDQ5LC

/merchant/setpassword%3Facc%3DeyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJtZXppYW4iLCJjb3VudHJ5IjoiOTYiLCJjcmVhdGVkIjoxNTAwMzExODk2MDQ5LC

我的问题在于 %3Facc%D 我想让它变成 ?acc=

My problem lies in %3Facc%D i want this to become ?acc=

推荐答案

试试这个,

this.router.navigate( [
  'url', { id: 'companyId', param1: 'value1'
}]);

检查,如何处理angular 2中的查询参数

这篇关于Angular2 如何在我的网址中传递问号和一些单词的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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