javascript - AngularJS - Using ngTouch within a directive for mobile devices -
i'm using ngtouch
remove delay on mobile devices, on mobile devices clicking image nothing. on app, clicking image calls directive enlarge images, there no ng-click
. here directive:
app.directive('imagezoom', ['ngdialog', function(ngdialog) { return { restrict: 'a', scope: { image: '=' }, link: function(scope, element, attr) { attr.$observe('ngsrc',function(img) { element.bind('click', function(e) { e.stoppropagation(); if (something) { dosomething(); } else { ngdialog.open({ template here }); } }); }); } }; }]);
this working fine until introduced ngtouch
believe there issue element.bind('click'
aspect of not registering click. work fine on browser though directive does work.
listen element.bind('touchstart click', function(){ ... }
instead of click element.bind('click', function(){ ... }
.
Comments
Post a Comment