diff --git a/js/angular/directive/item.js b/js/angular/directive/item.js index c5fd9b8f0e..5486c0dc8b 100644 --- a/js/angular/directive/item.js +++ b/js/angular/directive/item.js @@ -44,24 +44,39 @@ IonicModule //Lame way of testing, but we have to know at compile what to do with the element /ion-(delete|option|reorder)-button/i.test($element.html()); - if (isComplexItem) { - var innerElement = jqLite(isAnchor ? ITEM_TPL_CONTENT_ANCHOR : ITEM_TPL_CONTENT); - innerElement.append($element.contents()); + if (isComplexItem) { + var innerElement = jqLite(isAnchor ? ITEM_TPL_CONTENT_ANCHOR : ITEM_TPL_CONTENT); + innerElement.append($element.contents()); - $element.append(innerElement); - $element.addClass('item item-complex'); - } else { - $element.addClass('item'); - } + $element.append(innerElement); + $element.addClass('item item-complex'); + } else { + $element.addClass('item'); + } - return function link($scope, $element, $attrs) { - $scope.$href = function() { - return $attrs.href || $attrs.ngHref; - }; - $scope.$target = function() { - return $attrs.target || '_self'; - }; + return function link($scope, $element, $attrs) { + var listCtrl; + $scope.$href = function() { + return $attrs.href || $attrs.ngHref; }; + $scope.$target = function() { + return $attrs.target || '_self'; + }; + + $scope.$on('$ionic.disconnectScope', cleanupDragOp); + + function cleanupDragOp() { + // lazily fetch list parent controller + listCtrl || (listCtrl = $element.controller('ionList')); + if (!listCtrl || !listCtrl.listView) return; + + if (listCtrl.listView._lastDragOp) { + listCtrl.listView.clearDragEffects(); + } + + } + }; + } }; }); diff --git a/js/angular/directive/list.js b/js/angular/directive/list.js index 5ef5413bf7..ca0a0752f9 100644 --- a/js/angular/directive/list.js +++ b/js/angular/directive/list.js @@ -91,8 +91,8 @@ function($timeout) { controller: '$ionicList', compile: function($element, $attr) { var listEl = jqLite('