I'm trying to have swipe gesture in my app using ionic framework. The code is working in my browser well but when I install/run it in mobile device no gestures are working.
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();
};
I do swipe event in my ion-content thus:
<ion-content on-swipe-left="swipe();">
In controller:
$scope.swipe = function () {
$state.go("main.agenda.allEvents");
}
It has worked.