ui-router: location 'replace' not working

I’m doing a transition to the same state (different params) and I intend to NOT keep this transition in history, so I did

$state.go("state.name", {param: param}, {location: 'replace'});

But when I go back it still goes through all the previous states.

About this issue

  • Original URL
  • State: closed
  • Created 10 years ago
  • Comments: 35 (6 by maintainers)

Most upvoted comments

still not wokring +1

@inad9300 next time please be considerate of the amount of time OSS maintainers spend. Snarky comments like “Still not working ++++” make me reconsider my involvement in OSS.

“if many people say this feature does not work, at least take the time to verify it properly”

I couldn’t reproduce the issue. I posted a WORKING EXAMPLE. Issues without reproductions are very frustrating. I appreciated that you posted the plunker though 👍

$state.go('place.to.be', $stateParams, { location: 'replace' }) is working for me.

I think the issue most people run into here is passing { location: 'replace' } as the second argument instead of the third.

Still not working ++++

I appreciate the effort you put on developing this open source tool, but please, if many people say this feature does not work, at least take the time to verify it properly, otherwise who is going to rely on it?

I modified your plunkr to show the case when it doesn’t work: when you programmatically call go() with {location: 'replace'}, which I think is the most common use case (as oppose to embed the options on the HTML).

There you can see how states are pushed into the history despite the “replace” intention, and you can still go back to them: https://plnkr.co/edit/i3R8jaRS6TrMz3KKHT10?p=preview

still not working +++

still not working ++

still not wokring +1