Reputation: 19569
How can I push query params (page, limit) to url in angular, preferably without navigation.
I'm using the new, vladivostok router (npm @angular/router@3) and I have a table with paging. So when I click "next page" or change the number of items per page, I want to have that in the url.
I know I can programatically router.navigateByUrl('/users?page=3')
or similar, but can I avoid navigating at all and just update the url? My services will reload the table and everything as needed. Or is that not the way to go?
Upvotes: 0
Views: 993
Reputation: 23506
I think using window.history would do the trick:
window.history.pushState(null, "pagetitle", "users?page=4");
Upvotes: 1