IonicGestures not working on mobile

I am trying to use gestures in my application using an ionic structure. The code works in my browser, but when I install it and run it on a mobile device, no gestures work.

Here is my code

app.directive('detectGestures', function ($ionicGesture) {
    return {
        restrict: 'A',

        link: function (scope, elem, attrs) {
            var gestureType = attrs.gestureType;
            $ionicGesture.on('swipeup', scope.reportEvent, elem);
            $ionicGesture.on('swipedown', scope.reportEvent, elem);
            $ionicGesture.on('swiperight', scope.reportEvent, elem);
            $ionicGesture.on('swipeleft', scope.reportEvent, elem);
        }
    };
});

      

Controller.js

$scope.reportEvent = function (event) {
    alert("1");
    console.log('Reporting : ' + event.type);
    event.preventDefault();

    login();
};

      

+3


source to share


1 answer


I am posting an event in my ion content in this way:

<ion-content on-swipe-left="swipe();">

      

In the controller:



$scope.swipe = function () {
        $state.go("main.agenda.allEvents");
    }

      

It worked.

0


source







All Articles