fix(collectionRepeat): ignore spacing of hidden elements (ion-refresher)

Closes #1970
This commit is contained in:
Andrew
2014-08-11 10:04:55 -04:00
parent 044fac4d77
commit 9bfa3bd18b
3 changed files with 6 additions and 1 deletions

View File

@@ -217,6 +217,8 @@ function($collectionRepeatManager, $collectionDataSource, $parse) {
rerender(value);
});
// Find every sibling before and after the repeated items, and pass them
// to the dataSource
var scrollViewContent = scrollCtrl.scrollView.__content;
function rerender(value) {
var beforeSiblings = [];
@@ -226,6 +228,7 @@ function($collectionRepeatManager, $collectionDataSource, $parse) {
if ( ionic.DomUtil.elementIsDescendant($element[0], node, scrollViewContent) ) {
before = false;
} else {
if (node.hasAttribute('collection-repeat-ignore')) return;
var width = node.offsetWidth;
var height = node.offsetHeight;
if (width && height) {

View File

@@ -64,7 +64,7 @@ IonicModule
replace: true,
require: '^$ionicScroll',
template:
'<div class="scroll-refresher">' +
'<div class="scroll-refresher" collection-repeat-ignore>' +
'<div class="ionic-refresher-content" ' +
'ng-class="{\'ionic-refresher-with-text\': pullingText || refreshingText}">' +
'<div class="icon-pulling">' +

View File

@@ -18,6 +18,7 @@
</a>
</ion-header-bar>
<ion-content>
<ion-refresher on-refresh="loadMore()"></ion-refresher>
<p>
Hi, I'm some text before the list.
</p>
@@ -61,6 +62,7 @@ function MainCtrl($scope, $ionicScrollDelegate, $timeout, $q, $ionicLoading) {
var n = 1 + Math.floor(4*Math.random());
for (var i = 0; i < n; i++) addImage();
$scope.$broadcast('scroll.infiniteScrollComplete');
$scope.$broadcast('scroll.refreshComplete');
}, 1500);
};
}