Angular2如何在URL中传递问号和一些单词 [英] Angular2 how can i pass a question mark and some words in my url
问题描述
您好,我正在尝试向导航网址中添加一些字符串参数,例如
this.router.navigate(['/ merchant / setpassword?acc ='+ response.infoCode]) ;
,但是当我使用时,将我重定向到
/merchant/setpassword%3Facc%3DeyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJtZXppYW4iLCJjb3VudHJ5IjoiOTYiLCJjcmVhdGVkIjoxNTAwMzExODk2MDQ$b是
是
是
/ p>
解决方案尝试一下,
this.router.navigate([
'url',{id:'companyId',param1:'value1'
}]);;
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
My problem lies in %3Facc%D i want this to become ?acc=
解决方案Try this,
this.router.navigate( [ 'url', { id: 'companyId', param1: 'value1' }]);
Check, How to handle query parameters in angular 2
这篇关于Angular2如何在URL中传递问号和一些单词的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!