javascript - How to call a method on starting touch/drag in AngularJS -


i used https://github.com/fatlinesofcode/ngdraggable drag&drop in angularjs. works fine, need operations when user starting dragging. mymethod(). implemented ng-mousedown. on desktops there no problems, doesn't work on touch devices.

 <div ng-drag="true" ng-drag-data="myobject" ng-mousedown="mymethod()">     123  </div> 

any ideas?

for have same problem:

i used $swipe service of ngtouch module. given div directive. on dragging mymethod() called.

html:

<my-directive ng-drag="true" ng-drag-data="myobject" on-drag="mymethod()"></my-directive> 

directive:

angular.module('myapp') .directive('mydirective', ['$swipe',   function($swipe) {      return {       restrict: 'ea',       scope: {         ondrag: '&'       },       link: function(scope, ele, attrs, ctrl) {       $swipe.bind(ele, {           'start': function(coords) {             scope.ondrag();           }       }     } }]); 

Comments

Popular posts from this blog

node.js - Using Node without global install -

How to access a php class file from PHPFox framework into javascript code written in simple HTML file? -

java - Null response to php query in android, even though php works properly -