Passing strings as route parameters in Angular without encoding

Viewed 18403

I am trying to pass a string using this code:

  this.router.navigate(['/systems', params.toString()]);

The route parameter is then appended to a URL for an API call. The params.toString() is change_user=2258. When it is sent through the browser however, it is changed to change_user%3D2558 on the URL. When I use the developer tools to see what was sent to the API, it was changed to NaN.
How do I pass a string through a router, so that I can directly append it to my API string?

Edit: The variable params is of type URLSearchParams(). This is how I'm trying to extract the parameter:

this.route.paramMap.switchMap((params: ParamMap) => 
this.httpService.getSites(+params.get('params')))
.subscribe(sites => this.sites = sites);
2 Answers
Related