PierreD
PierreD

Reputation: 963

Angular query params is object object

I'm trying to navigate including query params:

this.router.navigate(['/forum/topic/1', { queryParams: { reply: 5 } }]);

But it redirect me to /forum/topic/1;queryParams=%5Bobject%20Object%5D

Expected behavior:

/forum/topic/1?reply=5

Looking at the document I see they edit the params because I see it's separate with ;

localhost:4200/heroes;id=15;foo=foo

What are they doing ?

1) How can I fix the redirection, I think the function is fine...

2) I don't want ;, I want classic ? and &, is it possible ?

Upvotes: 2

Views: 3114

Answers (1)

Rozan
Rozan

Reputation: 46

I think you have a typo. Look at parenthesis. Try this:

this.router.navigate(['/forum/topic/1'], { queryParams: { reply: 5 } });

Upvotes: 3

Related Questions