Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

4
  • 4
    This seems to clobber the back button. Commented Jan 26, 2016 at 22:53
  • 6
    @Swordfish0321 to fix the back button, make this small change: $state.go(to.redirectTo, params, {location: 'replace'}); This will cause the new state to replace the previous state (ie the one we're being redirected from) in the history. See docs for $state.go: angular-ui.github.io/ui-router/site/#/api/… Commented Apr 25, 2016 at 10:44
  • 2
    Just wanted to add on that this was real close to what I wanted to do, but I wanted the default URL instead of replacing it, this was easily accomplished by changing '$stateChangeStart' to '$stateChangeSuccess' Commented May 9, 2016 at 20:54
  • 6
    ui-router 1.0 has built in support for this: ui-router.github.io/guide/ng1/… Commented Aug 24, 2017 at 14:46