3

I am adding some query string parameters to my angular route

http://localhost:4200/home/transactions?toDate=2019-02-26&fromDate=2018-01-01&startIndex=0&pageSize=20&showCashedOut=true

If i change any value in the query parameters from the URL tab it refreshes the page, Is there any way in angular to prevent this behavior? I want to be able to change the value and prevent refresh on the page. I have looked up on stack overflow and other resources

Any help would be appreciated.

1 Answers1

0

Refreshing the page when changing the url in the Browser URL Tab is inevitable. It can only be prevented with a browser dialog "Do you want to leave this page", but I guess that is not your usecase.

If you want to the change the url in your application, please look at location.replaceState(). Alternatively you can implement a route guard for more custom scenarios.

Julien Ambos
  • 2,010
  • 16
  • 29