From 9d301eedb296c0f44d19a82e09063a41c3e59267 Mon Sep 17 00:00:00 2001 From: "Neeson.Z" Date: Thu, 16 Jun 2016 12:05:03 +0800 Subject: [PATCH] =?UTF-8?q?Drag=20and=20drop=20on=20the=20same=20sets=20of?= =?UTF-8?q?=20elements,=20like=20swapping=20operations,=20pass=20on=20drop?= =?UTF-8?q?ped=20element=E2=80=99s=20bind=20data/obj=20to=20onDropComplete?= =?UTF-8?q?=20call.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- example-dropdata.html | 80 +++++++++++++++++++++++++++++++++++++++++++ ngDraggable.js | 5 ++- 2 files changed, 84 insertions(+), 1 deletion(-) create mode 100755 example-dropdata.html diff --git a/example-dropdata.html b/example-dropdata.html new file mode 100755 index 0000000..201092f --- /dev/null +++ b/example-dropdata.html @@ -0,0 +1,80 @@ + + + + ngDraggable + + + + + +
+ +
+

ngDraggable Example

+
+ + + +
+ + + + + + + diff --git a/ngDraggable.js b/ngDraggable.js index 3f4a2ee..3d83bf6 100644 --- a/ngDraggable.js +++ b/ngDraggable.js @@ -281,6 +281,8 @@ angular.module("ngDraggable", []) var onDragStopCallback = $parse(attrs.ngDragStop); var onDragMoveCallback = $parse(attrs.ngDragMove); + var getDragData = $parse(attrs.ngDragData); + var initialize = function () { toggleListeners(true); }; @@ -339,8 +341,9 @@ angular.module("ngDraggable", []) } if (attrs.ngDropSuccess) { + var _data = getDragData(scope); $timeout(function(){ - onDropCallback(scope, {$data: obj.data, $event: obj, $target: scope.$eval(scope.value)}); + onDropCallback(scope, {$data: obj.data, $event: obj, $dropdata: _data, $target: scope.$eval(scope.value)}); }); } }