I am using the navigate
function of Router
in angular. This is resulting in navigating once but creating two navigations in history and URL is automatically updated with some part of URL being stripped off like mentioned below:
this.router.navigate(['buses','big','bus-details'],queryParamas:{busId:'abc'});
then in the first navigation the url would be localhost:4200/buses/big/bus-details?busId=abc
but not even in a second the url will be updated to localhost:4200/buses/big/bus-details
and when I click back button of browser I am taken to url localhost:4200/buses/big/bus-details?busId=abc
although the ngOnInit()
function is called only once while moving from first update to second update of url.
I have always been navigating like this but there has never been a problem. I have even checked that NavigationStart
event is only fired once.
What I am looking for is that this update of URL should not happen, what can I do to prevent update of URL while navigating?
from some part of URL path is removed and double nagivation in browser history
No comments:
Post a Comment