I have a router view
with reloadOnSearch: false
, it is a search page.
When entering without any search parameter I attempt to set some defaults:
entering in: #/search
I set defaults pars: #/search?currpage=1&pagesize=20
using $location.search({currpage:1,pagesize:20})
the job is done, but I also get the new url pushed in the history, which is as expected, but in this special case it breaks the logic of the navigation flow (clicking back button gets to #/search
and again sets defaults and pushes)
Is there a way to replace the search string preventing the history push?
Have you tried to you use the dedicated replace() method ? It prevent to add an history record :
$location.search({currpage:1,pagesize:20}).replace()
Never used it after a $location.search()
but it definitely works on $location.path()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With