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

View File

@@ -24,16 +24,17 @@
</ion-header-bar>
<ion-content direction="y">
<h2> stuff before</h2>
<div class="list">
<ion-list can-swipe="true">
<div collection-repeat="item in contacts | filter:filter | orderBy:'last_name' | ionLetterDividers:'last_name'"
divider-collection-repeat
force-refresh-images>
<a class="item item-avatar">
<ion-item class="item item-avatar">
<img ng-src="http://lorempixel.com/60/60?q={{$index}}">
<h2>{{item.first_name+' '+item.last_name}}</h2>
<p>{{$index}}</p>
</a>
</div>
<ion-option-button>HELLO</ion-option-button>
</ion-item>
</ion-item>
</div>
HELLO
<div class="card">interim</div>