amend(collectionRepeat): broadcast event when element changes positions

This commit is contained in:
Andrew
2015-02-24 13:47:16 -07:00
parent bb866da3d7
commit 3befdd7429
3 changed files with 12 additions and 16 deletions

View File

@@ -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;
}
}

View File

@@ -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)');
});
}
};
}