diff --git a/Sortable.js b/Sortable.js index 60cd0bd..3176f3a 100644 --- a/Sortable.js +++ b/Sortable.js @@ -469,7 +469,7 @@ !options.dragoverBubble && evt.stopPropagation(); } - if (!_silent && activeGroup && + if (!_silent && activeGroup && !options.disabled && (isOwner ? canSort || (revert = !rootEl.contains(dragEl)) : activeGroup.pull && groupPut && ( @@ -949,8 +949,10 @@ */ function _index(/**HTMLElement*/el) { var index = 0; - while (el && (el = el.previousElementSibling) && (el.nodeName.toUpperCase() !== 'TEMPLATE')) { - index++; + while (el && (el = el.previousElementSibling)) { + if (el.nodeName.toUpperCase() !== 'TEMPLATE') { + index++; + } } return index; } diff --git a/ng-sortable.js b/ng-sortable.js index 8d310c4..ecbf23b 100644 --- a/ng-sortable.js +++ b/ng-sortable.js @@ -15,7 +15,7 @@ 'use strict'; angular.module('ng-sortable', []) - .constant('$version', '0.3.4') + .constant('$version', '0.3.5') .directive('ngSortable', ['$parse', function ($parse) { var removed, nextSibling; @@ -101,13 +101,16 @@ onStart: function (/**Event*/evt) { nextSibling = evt.item.nextSibling; options.onStart(source.items()); + scope.$apply(); }, onEnd: function () { options.onEnd(source.items()); + scope.$apply(); }, onAdd: function (/**Event*/evt) { _sync(evt); options.onAdd(source.items(), removed); + scope.$apply(); }, onUpdate: function (/**Event*/evt) { _sync(evt);