Custom Back Button


My app has multiple views. I switch between them using $location.path(). It is working well.

I do not want the “history” implementation to dictate the behavior of my back buttons. I would rather give a target path to each back button. I know that I can do this by setting the leftButtons array. But how can I force a “backward slide animation” to the target path?


I observed that Ionic does use the “backward slide” animation on $location.path(target) if, and only if, target == previous page in history.

The concept of history is not relevant to my particular app. I would like to control the target paths and associated animation behavior manually.


How do you “set the left button array” ?


Here is an example. The button looks good and it does to the right place. But I cannot control the animation. It will show the “backward slide” animation if ‘feed’ happens to be the previous page in history. I want it to use “backward slide” always.

    $scope.leftButtons = [
            type: 'button-clear icon-left ion-ios7-arrow-left',
            content: 'Back',
            tap: function (e) {