Ionic swipe back on certain div element instead of ion-view with animation

260 views Asked by At

I know that Ionic supports native like swipe back animations between views simply by using the can-swipe-back attribute of the ion-view element. Does anyone know if there is a way to allow the swiping only for a certain div container within the ion-view element?

1

There are 1 answers

1
devqon On

In Ionic you can define any element with the swipe attribute:

<div on-swipe-left="onSwipeLeft()" class="button">
    <!-- some html -->
</div>

controller:

$scope.onSwipeLeft = function() {
    // Do anything, like going back in history
    $ionicHistory.goBack();
}