chnselim
chnselim

Reputation: 254

Pass optional parameters to URL

I want to pass optional params such as filters & page numbers to route. I'm using RequestOptions to pass query parameters and it works for filter and paginataion, but URL never changes.

e.g: i have uri/cars route, when i click second page content is updating for 2nd page but URL still same as uri/cars.

I want uri/cars?page=2 when i do this example. Thanks.

Upvotes: 1

Views: 6130

Answers (1)

Jaron Thatcher
Jaron Thatcher

Reputation: 824

When you call router.navigate(), you can use the queryParams object to send additional parameters.

In your example, you could use something like this:

this.router.navigate(['uri/cars'], {queryParams: {'page': 2}});

Upvotes: 3

Related Questions