Ionic

How To Disable IOS Swipe To Go Back In Ionic 1.x Apps

Posted by Weston Ganger on July 26, 2016

When building games or certain components in my ionic applications, I dont want the user to be able use the browser back function using the iOS swipe to go back. Ionic makes it simple to do this.

If you want to disable this on a per-page basis you can simply do the following:


<ion-view can-swipe-back="false">
   <!-- page content -->
</ion-view>

OR

You may want to do this in some javascript logic:


.controller('MyCtrl', function($scope, $ionicConfig) {
  // Disable
  $ionicConfig.views.swipeBackEnabled(false);

  // Enable
  $ionicConfig.views.swipeBackEnabled(true);
});

You can apply this method in any way you want such as disabling with certain routes, disable on enter of a view and enable on leave or just in general.


Related External Links:


Posted in Ionic and Tagged with ionic ios gesture 


Need help on your next project or application?

I specialize in Ruby-on-Rails, AngularJS, Javascript, Bootstrap, and Hybrid Mobile Apps with Cordova & Ionic.

Contact Me

Recommended Posts