when i say back button i mean the actual button on the device.
what i am looking for is that i want a confirm exit on the home view of my app and on other views the normal back in history behavior.
i am using side menu template of ionic
**on home view:->**
var deregister = $ionicPlatform.registerBackButtonAction(
function () {
console.log("close the popup")
}, 100
);
//Then when this scope is destroyed, remove the function
$scope.$on('$destroy', deregister)
Store your back button registration in a variable -> destroys the function if the view gets destroyed .
This work but when the controller initially loads but if navigate from home->view2->home again this dosn’t seem to work as the scope has been destroyed
what is the way around this?