Reputation: 963
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
Reputation: 46
I think you have a typo. Look at parenthesis. Try this:
this.router.navigate(['/forum/topic/1'], { queryParams: { reply: 5 } });
Upvotes: 3