I am currently looking for a software/web development job preferably as a Rails-based developer.
Please email me at weston@westonganger.com. Thanks in advance for any leads!

Disable Hardware Back Button In An Ionic 1.x App

Posted by Weston Ganger

I wanted to disable the back button in a game I was making with Ionic.

This code must go in your apps .run function, it will not work in your controllers.


/* www/js/app.js */

// To Disable Back in Entire App
$ionicPlatform.registerBackButtonAction(function(){
  event.preventDefault();
}, 100);

// To Conditionally Disable Back
$ionicPlatform.registerBackButtonAction(function(){
  if($ionicHistory.currentStateName === 'someStateName'){
    event.preventDefault();
  }else{
    $ionicHistory.goBack();
  }
}, 100);


Related External Links:

Article Topic:Software Development - Ionic

Date:November 21, 2015

Recommended Posts