How can i use register Back Button action to call location path?



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.



$ionicPlatform.registerBackButtonAction(function(e) {
               window.location = "#/app/Test"; 

                }, 100);


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){

$scope.$on(’$destroy’, deregister);

Thank You.


Hello @jay
Is it working?


Hi i used the following solution…


and i also checked


its also working