I try to disable back button on android device with "keyboard: false" but it not work.
$ionicModal.fromTemplateUrl('templates/login.html', {
scope: $scope,
keyboard: false
})
How to disable it. Thank you.
I try to disable back button on android device with "keyboard: false" but it not work.
$ionicModal.fromTemplateUrl('templates/login.html', {
scope: $scope,
keyboard: false
})
How to disable it. Thank you.
ionicModal provides hardwareBackButtonClose
option to set false
for this behaviour.
$ionicModal.fromTemplateUrl('templates/login.html', {
scope: $scope,
hardwareBackButtonClose: false
})
Please see related documentation : http://ionicframework.com/docs/api/controller/ionicModal/
Another option could be: isShown() method as mentioned in the docs http://ionicframework.com/docs/api/controller/ionicModal/
You can go for something like this
if(!$scope.modal.isShown()){
navigator.app.exitApp();
} else{
//do nothing...
}
Check this thread: Disable hardware back button in Ionic application?
This should do it:
$ionicPlatform.registerBackButtonAction(function () {
if (condition) {
navigator.app.exitApp();
} else {
handle back action!
}
}, 100);
But I would advice against this unless you really need to. Breaking the expected model of operation very slightly hurts the entire platform.