2016-11-26 106 views
1

之间解决冲突在我目前的离子应用程序,我已经在一个元件上使用on-hold()ion-option-button。当我在Android设备上运行我的应用程序时(cli:ionic run android),所以我认为他们之间存在冲突(有时候ion-option-button工作,有时候并没有这样做)。工作),因为当我删除搁置()ion-option-button工作正常和流畅如何离子对保持和离子选项按钮

有什么建议吗?

回答

1

我解决了我的问题。它有时会出错,但比以前更好,令人满意。

app.directive("myOnHold", ['$ionicGesture', function ($ionicGesture) { 
    return { 
     restrict: "A", 
     link: function ($scope, $element, $attr) { 
      var handleDrag = function (e) { 
       e.preventDefault() 
      }; 

      var dragGesture = $ionicGesture.on('hold', handleDrag, $element); 

      $scope.$on('$destroy', function() { 
       // Unbind drag gesture handler 
       $ionicGesture.off(dragGesture, 'drag', handleDrag); 
      }); 
     } 
    } 
    }])