0

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

1 Answer 1

1
  1. 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.

  2. 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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.