Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ Draggable usage:
```ng-drag-start``` and ```ng-drag-move``` is also available. Add to the ng-drop element.
``ng-drag-stop`` can be used when you want to react to the user dragging an item and it wasn't dropped into the target container.

```ng-drag-dynamic``` can be used when you want to set ng-drop enable value at the moment you start dragging.

```draggable:start```, ```draggable:move``` and ```draggable:end``` events are broadcast on drag actions.


Expand Down
10 changes: 9 additions & 1 deletion ngDraggable.js
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,8 @@ angular.module("ngDraggable", [])
var onDragStartCallback = $parse(attrs.ngDragStart);
var onDragStopCallback = $parse(attrs.ngDragStop);
var onDragMoveCallback = $parse(attrs.ngDragMove);

var onDragDynamicCallback = $parse(attrs.ngDragDynamic);

var initialize = function () {
toggleListeners(true);
};
Expand All @@ -304,6 +305,13 @@ angular.module("ngDraggable", [])
_dropEnabled=newVal;
};
var onDragStart = function(evt, obj) {
if(attrs.ngDragDynamic) {
$timeout(function(){
var enable = onDragDynamicCallback(scope, {$data: obj.data, $event: obj});
_dropEnabled = enable;
});
}

if(! _dropEnabled)return;
isTouching(obj.x,obj.y,obj.element);

Expand Down