There is one service provided for enabling-disabling the back button, in ionic cordova app.
https://gist.github.com/mircobabini/689955216a036544d594
https://gist.github.com/mircobabini/689955216a036544d594
.service( 'HardwareBackButtonManager', function($ionicPlatform){ this.deregister = undefined; this.disable = function(){ this.deregister = $ionicPlatform.registerBackButtonAction(function(e){ e.preventDefault(); return false; }, 101); } this.enable = function(){ if( this.deregister !== undefined ){ this.deregister(); this.deregister = undefined; } } return this; }) // usage .controller( 'YourController', function( 'HardwareBackButtonManager' ){ HardwareBackButtonManager.disable(); // re-enable it when you want, HardwareBackButtonManager.enable(); })// usage
.controller( 'YourController', function( 'HardwareBackButtonManager' ){ HardwareBackButtonManager.disable(); // re-enable it when you want, HardwareBackButtonManager.enable(); })