jay
1
Hello,
how to use $ionicPlatform.registerBackButtonAction to call $location.path(’/specific-page’) ?
i have tried like this…
var deregister = $ionicPlatform.registerBackButtonAction(function(){ $location.path(’/specific-page’); },100);
but its not working, am i doing something wrong ?
can i register onBackPress event of cordova in controller ?
thank you.
After your $location.path() command, add this line.
$ionicSideMenuDelegate.toggleLeft(false);
Try…
$ionicPlatform.registerBackButtonAction(function(e) {
window.location = "#/app/Test";
or
$state.go('app.Test');
}, 100);
1 Like
jay
4
hello @renjithvincent
first of all, sorry for late reply…
alert(typeof $location) was prompting “undefined” in registerBackButtonAction function.
so i used @shashikant 's code, and at this stage i got three solution
1st = window.location = “#/app/Test”;
2nd = $state.go(‘app.Test’);
3rd = my code as follow
var deregister = $ionicPlatform.registerBackButtonAction(function(event){
event.preventDefault();
event.stopPropagation();
$state.transitionTo(“profile”);
},100);
$scope.$on(’$destroy’, deregister);
Thank You.
Hello @jay
Is it working?
jay
6
Hi i used the following solution…
$state.transitionTo(“profile”);
and i also checked
$state.go(‘profile’);
its also working
thanks
1 Like