Ala'a Mezian
Ala'a Mezian

Reputation: 327

Angular2 how can i pass a question mark and some words in my url

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=

Upvotes: 2

Views: 1856

Answers (1)

Imran
Imran

Reputation: 1902

Try this,

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

Check, How to handle query parameters in angular 2

Upvotes: 3

Related Questions