From 3befdd7429e2eebe5bb4d2af1bd66b5ee35f74da Mon Sep 17 00:00:00 2001 From: Andrew Date: Tue, 24 Feb 2015 13:47:16 -0700 Subject: [PATCH] amend(collectionRepeat): broadcast event when element changes positions --- js/angular/directive/collectionRepeat.js | 1 + js/angular/directive/item.js | 18 ++++++------------ test/html/collection-repeat/contacts.html | 9 +++++---- 3 files changed, 12 insertions(+), 16 deletions(-) diff --git a/js/angular/directive/collectionRepeat.js b/js/angular/directive/collectionRepeat.js index 38e9b8fb40..b28ff2be59 100644 --- a/js/angular/directive/collectionRepeat.js +++ b/js/angular/directive/collectionRepeat.js @@ -510,6 +510,7 @@ function RepeatManagerFactory($rootScope, $window, $$rAF) { item = itemsShownMap[i]; delete itemsShownMap[i]; itemsLeaving.push(item); + item.scope.$broadcast('$collectionRepeatChange'); item.isShown = false; } } diff --git a/js/angular/directive/item.js b/js/angular/directive/item.js index 776961b37b..fa68be5c38 100644 --- a/js/angular/directive/item.js +++ b/js/angular/directive/item.js @@ -29,6 +29,7 @@ var ITEM_TPL_CONTENT = */ IonicModule .directive('ionItem', function() { + var nextId = 0; return { restrict: 'E', controller: ['$scope', '$element', function($scope, $element) { @@ -63,19 +64,12 @@ IonicModule 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; - - var lastDragOp = listCtrl.listView._lastDragOp || {}; - if (lastDragOp.item === $element[0]) { - listCtrl.listView.clearDragEffects(true); - } + var content = $element[0].querySelector('.item-content'); + if (content) { + $scope.$on('$collectionRepeatChange', function() { + content && (content.style[ionic.CSS.TRANSFORM] = 'translate3d(0,0,0)'); + }); } - }; } diff --git a/test/html/collection-repeat/contacts.html b/test/html/collection-repeat/contacts.html index 1bf60864d8..0b42598793 100644 --- a/test/html/collection-repeat/contacts.html +++ b/test/html/collection-repeat/contacts.html @@ -24,16 +24,17 @@

stuff before

- HELLO
interim