2016-11-26 104 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); 
      }); 
     } 
    } 
    }])