How to use $windows.history.back


In angular we can use $windows.history.back to back to previous view. How do it with ionic? I try $windows.history.back, but it doesn’t work


Sorry, but we haven’t entirely finalized the API for this yet. But what you can do is use the $ionicViewService to get the “backView”, then call “go” on the view.

var backView = $ionicViewService.getBackView();

We’ll be making this simpler and improving the documention as we move forward. You could also look into use the ionNavBackButton directive. Hope this helps.


Any ETA on the $ionicViewService documentation?? Seems like a much better option than $location.path(’/app’) …

So $location.path(’/app/home’) is better done by $state.go(‘app.home’)

However, is $ionicViewService able to change the default animation? Instead of a slide left-right, a slide up-down?


Right now, I don’t think there is any documentation. Your best bet is reviewing the code:

This entry shows some samples about using the $ionicViewService : Changing the back-button "url" / "back state"