Nico205
1
Hey,
I´ve tried to override the backbutton function on some views but it didn´t worked.
I´ve used this code in the .run function in the app.js:
$ionicPlatform.registerBackButtonAction(function (event) {
if($state.current.name=="app.splash"){
navigator.app.exitApp();
}
else {
navigator.app.backHistory();
}
}, 100);
If I use this code the app goes back like normal…
Regards
Nico
boltex
2
I use it like so, in the .run but also inside the $ionicPlatform.ready :
$ionicPlatform.ready(function(){
$ionicPlatform.registerBackButtonAction(function(e){
if( $state.is('app.login') ){
if (confirm('Are you sure you want to Exit?')) {
// Save it!
console.log('Goodbye!');
ionic.Platform.exitApp();
return false;
} else {
e.preventDefault();
return false;
}
}
if( $state.is('app.activities') || $state.is('app.map') || $state.is('app.equipdetails') || $state.is('app.bookingdetails') || $state.is('app.references') ){
$state.go('app.taskdetails');
}
}
}