mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
amend(collectionRepeat): broadcast event when element changes positions
This commit is contained in:
1
js/angular/directive/collectionRepeat.js
vendored
1
js/angular/directive/collectionRepeat.js
vendored
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
18
js/angular/directive/item.js
vendored
18
js/angular/directive/item.js
vendored
@@ -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)');
|
||||
});
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user