Skip to content
This repository was archived by the owner on Sep 8, 2020. It is now read-only.

Commit 03ee1c2

Browse files
committed
feat(sortable): add extra properties to ui.item.sortable
1 parent c0679e3 commit 03ee1c2

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/sortable.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,10 @@ angular.module('ui.sortable', [])
8888

8989
// Save the starting position of dragged item
9090
ui.item.sortable = {
91+
model: ngModel.$modelValue[ui.item.index()],
9192
index: ui.item.index(),
93+
source: ui.item.parent(),
94+
sourceModel: ngModel.$modelValue,
9295
cancel: function () {
9396
ui.item.sortable._isCanceled = true;
9497
},
@@ -145,7 +148,9 @@ angular.module('ui.sortable', [])
145148
// the value will be overwritten with the old value
146149
if(!ui.item.sortable.received) {
147150
ui.item.sortable.dropindex = ui.item.index();
148-
ui.item.sortable.droptarget = ui.item.parent();
151+
var droptarget = ui.item.parent();
152+
ui.item.sortable.droptarget = droptarget;
153+
ui.item.sortable.droptargetModel = droptarget.scope().$eval(droptarget.attr('ng-model'));
149154

150155
// Cancel the sort (let ng-repeat do the sort for us)
151156
// Don't cancel if this is the received list because it has

0 commit comments

Comments
 (0)