Hi i'm trying replacing
site.com/u#asd
with
site.com/u
in browser url bar , and i would like to not refresh the page while replacing url
Is this possible?
I tryed:
$location.replace("#asd","");
but it obviously won't work
You're misusing replace()
- it accepts no arguments, and its purpose is said to replace the history record:
If called, all changes to $location during current $digest will be replacing current history record, instead of adding new one.
You should not use replace in the first place. Instead, call $location.url()
, it will not refresh the page (unless you pass true
as a second argument).
From the $location
dev guide:
It does not cause a full page reload when the browser URL is changed.