Reputation: 373
How can I do this in Angular:
window.location.href = window.location.href + "/?id = 123";
So append new paramater to the end of the url and refresh the page(without loading it from cache).
Upvotes: 1
Views: 10378
Reputation: 9
Use $window :
$window.location.href = $location.path() + "/?id = 123";
Or use $location :
$location.url($location.path() + "/?id = 123");
The results are same, only view is reload by angular, this is not a force refresh by the browser.
Upvotes: 0
Reputation: 1794
You can use $location
for that.
Example: $location.search('id','123)
That is going to append ?id=123
to the current page url and do a soft refresh.
Then to do a hard refresh you can do location.reload()
Upvotes: 4