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

Commit b82aed9

Browse files
roboncodethgreasi
authored andcommitted
Added check to only add items that have not been cancelled.
1 parent 555ad80 commit b82aed9

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/sortable.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,11 @@ angular.module('ui.sortable', [])
5959

6060
callbacks.receive = function(e, ui) {
6161
ui.item.sortable.relocate = true;
62-
// added item to array into correct position and set up flag
63-
ngModel.$modelValue.splice(ui.item.index(), 0, ui.item.sortable.moved);
62+
// if the item still exists (it has not been cancelled)
63+
if(ui.item.sortable.moved) {
64+
// added item to array into correct position and set up flag
65+
ngModel.$modelValue.splice(ui.item.index(), 0, ui.item.sortable.moved);
66+
}
6467
};
6568

6669
callbacks.remove = function(e, ui) {

0 commit comments

Comments
 (0)