Volodymyr Humeniuk
Volodymyr Humeniuk

Reputation: 3801

Object as queryParams in Angular 7

I have an object:

let paramsObj = {
    mode: "resetPassword", 
    oobCode: "dsaSdsxSFXx", 
    apiKey: "OQPzWYkFNe", 
    lang: "en"
   }

I want to use this object as queryParams for router navigate:

this.router.navigate(['/action', { queryParams: paramsObj}]);

But this is doesn't work. What is the correct way to do this?

Upvotes: 0

Views: 58

Answers (1)

Volodymyr Humeniuk
Volodymyr Humeniuk

Reputation: 3801

My bad, I wrote this.router.navigate(['/action', { queryParams: paramsObj}]);, but this is should be this.router.navigate(['/action'], { queryParams: paramsObj}); , and then it work as expected.

Upvotes: 1

Related Questions