i'd like to control the event of "press hardware back button" in ionic framework. This is my code. Why does not it work? thank you
.run(function ($ionicPlatform) {
$ionicPlatform.ready(function () {
if (window.StatusBar) {
StatusBar.styleDefault();
}
$ionicPlatform.registerBackButtonAction(function (event) {
event.preventDefault();
event.stopPropagation();
alert("Stop");
}, 100);
});
})
i also try the other solution:
.run(function ($ionicPlatform) {
$ionicPlatform.ready(function () {
if (window.StatusBar) {
StatusBar.styleDefault();
}
});
$ionicPlatform.registerBackButtonAction(function (event) {
event.preventDefault();
event.stopPropagation();
alert("Stop");
}, 100);
})
but it still doesn't work
thank you
that's what you want ? :
$ionicPlatform.registerBackButtonAction(function(e){
e.preventDefault();
return false;
}, 101);
credit to : mircobabini/Angular.Ionic.HardwareBackButtonManager.js https://gist.github.com/mircobabini/689955216a036544d594