Quantcast
Channel: Ionic Forum - Latest posts
Viewing all articles
Browse latest Browse all 228595

$ionicGesture.off not working

$
0
0

Hi, I used ionic gesture to set hold and doubletap gestures on my element. however, if no data is returned by server, i want to set off the gestures. Here is my code:

angular.module('starter')

.directive('rentDetail', function($ionicGesture, $ionicPopup, $state, BookService, $rootScope) {

var gesture = null;

var removeGesture = function() {
$ionicGesture.off(gesture, 'hold doubletap');
}

var templateText = function() {return ''};

var rentDetail = function(scope, elem, attrs) {
gesture = $ionicGesture.on('hold doubletap', function() {
$ionicPopup.alert({
title: "

Rent Detail

",
template: '

'+templateText()+'

',
okText: 'Dismiss'
})
}, angular.element(elem[0].getElementsByClassName('rz-pointer')))
}

return {
restrict: 'A',
link: function(scope, elem, attrs) {
rentDetail(scope, elem, attrs)

  $rootScope.$on('no-markers', function() {
    removeGesture();
  })
}

}
})

However, after setting the gesture through rentDetail(), I am unable to remove Gestures using removeGesture().

Could you point out why?


Viewing all articles
Browse latest Browse all 228595

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>