2017-06-14 30 views
1

如何在Angular UI樹中移動節點時詢問確認?如何在Angular UI樹中移動節點時詢問確認?

當我在樹上移動節點時,如何詢問確認(alert message)?

我試圖用回調dragStop

<div data-ui-tree="treeOptions" id="tree-root"> 

和功能是:

$scope.treeOptions = { 
    $scope.treeOptions = { 
      dragStop : function (e) { 
       alert("ok"); 
      } 
     };   
}; 

回答

0

beforeDrop(事件)

拖動節點被丟棄之前beforeDrop函數被調用。 如果您實現此回調,則返回值決定是否允許繼續放置事件 。

它sholud是:

$scope.treeOptions = { 
    beforeDrop : function (e) { 
    return confirm("Are you sure?"); 
    } 
};