Browse Source

- upd

pull/179/head
RubaXa 10 years ago
parent
commit
32f2f43c08
  1. 7
      ng-sortable.js

7
ng-sortable.js

@ -3,7 +3,7 @@
* @licence MIT * @licence MIT
*/ */
angular.module('ng-sortable', []) angular.module('ng-sortable', [])
.constant('$version', '0.3.1') .constant('$version', '0.3.2')
.directive('ngSortable', ['$parse', function ($parse) { .directive('ngSortable', ['$parse', function ($parse) {
'use strict'; 'use strict';
@ -28,9 +28,6 @@ angular.module('ng-sortable', [])
}, },
items: function () { items: function () {
return itemsExpr(scope); return itemsExpr(scope);
},
upd: function () {
itemsExpr.assign(scope, this.items());
} }
}; };
} }
@ -66,14 +63,12 @@ angular.module('ng-sortable', [])
removed = prevItems.splice(oldIndex, 1)[0]; removed = prevItems.splice(oldIndex, 1)[0];
items.splice(newIndex, 0, removed); items.splice(newIndex, 0, removed);
prevSource.upd();
evt.from.appendChild(evt.item); // revert element evt.from.appendChild(evt.item); // revert element
} else { } else {
items.splice(newIndex, 0, items.splice(oldIndex, 1)[0]); items.splice(newIndex, 0, items.splice(oldIndex, 1)[0]);
} }
source.upd();
scope.$apply(); scope.$apply();
} }

Loading…
Cancel
Save