@shaileshgupta wrote:
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?
Posts: 1
Participants: 1