Android back button - code


Hi Ionic Folks ! ,

I’m really struck at the android back functionality. If anyone could post a demo on codepen , it would be helpful .

Even if thats listed under the docs it will be helpful for the beginners…

Cheers , So far loving the ionicframework


You could do something like this

.controller('MyCtrl', function($scope, $ionicPlatform) {
   $ionicPlatform.onHardwareBackButton( function(){
    // Your function here


$ionicPlatform.registerBackButtonAction(function () {
  if (condition) {;
  } else {
    handle back action!
}, 100)

Check out the docs.$ionicPlatform/


thanks ill try it out and let you know


no luck my friend ! I tried it . Still it works similar to browser history.


Hi Mike , it worked at last . Thanks for the input guys .

I wanted to check this out in windowsphone , if it works hurray!!!

Cheers Guys ! loving Ionic