Is there an easy way to override the back button behavior on certain screens? I’ve been using leftButtons, but was hoping there was an easier way so I don’t need to put this in every controller that I want to change the behavior for.
The reason I want to change the behavior is because I’m integrating my app in a native iOS app and sometimes we want to go “back” into the app, using a custom protocol. However, when testing it outside of the app, I want the normal ionic back behavior.
$scope.leftButtons = [
{
type: 'button-clear',
content: '<i class="icon ion-arrow-left-c"></i>',
tap: function (e) {
if ($rootScope.isNative) {
location.href='jmh-ios://back'
} else {
// this doesn't always work as expected
history.back();
}
}
}
];