问题
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=
回答1:
Try this,
this.router.navigate( [
'url', { id: 'companyId', param1: 'value1'
}]);
Check, How to handle query parameters in angular 2
来源:https://stackoverflow.com/questions/45150143/angular2-how-can-i-pass-a-question-mark-and-some-words-in-my-url