Sometimes, you just can't go back. Or more to the point - you don't want your users to go back.

Imagine your app uses authentication for certain views. For whatever reason, you've decided to not use a modal for the authentication. So, a user is on a "public" view and taps to go to a view that requires authentication. The user is directed to a "Login" view. After they login, they are sent to the page they originally requested.

Now, they go back and .... oops. They're at the login page again. You definitely didn't want that to happen, right?

There's a request for this feature already. Unfortunately, you still have the problem today. If you're interested in this feature, please let the Ionic team know. However, don't do it via +1'ing. I think that gets really irritating.

Side Note: Max Lynch once suggested GitHub needs "voting" for issues. I completely agree. It'd be nice to have +1'ing without polluting the whole issue comment stream.

Here's a quick workaround that I've been using to overcome problems like this. I will warn you though that it only works some of the time. In some cases, I've not been able to use this trick.

// Search the view history for the view that you want to go back to
var entryViewId = _.find($ionicHistory.viewHistory().views, {url : "/entry"});

// Replace the current backview with the one you want users to actually go back to.
if(entryViewId) {
  $ionicHistory.backView(entryViewId);
}

Now, I realize this is a really nasty hack, but it works. At least it works some of the time. The $ionicHistory service is way over my head; so, I don't have an ideal solution or even quite understand how all of it works.

Hopefully, the Ionic team will document some much better way to accomplish this or expose some new methods in $ionicHistory to make this easier.