AngularJS ngTouch $swipe move doesn't work

738 Views Asked by At

I used ngTouch Module for implement some things for touch devices. 'start' works fine. But the console.log() in 'move' case has not been displayed, if I drag the object out of the first drop-zone. Inside the first drop-zone 'move' works.

HTML:

<div class="drop-zone" ng-trop="true">
    <my-directive ng-drag="true" ng-drag-data="myObject" on-drag="myMethod()"></my-directive>
</div>
<div class="drop-zone" ng-trop="true"></div>

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();
          },
          'move': function(coords) {
            console.log("IS MOVING");
          }
      }
    }
}]);

Maybe you are interested in my use case: I want the window scrolls automatically, if the user drags the object on the bottom of the page. Drag and drop is solved with ngDraggable ( https://github.com/fatlinesofcode/ngDraggable ) Maybe there are some alternatives. Any ideas?

0

There are 0 best solutions below