mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
fix(collectionRepeat): ignore spacing of hidden elements (ion-refresher)
Closes #1970
This commit is contained in:
3
js/angular/directive/collectionRepeat.js
vendored
3
js/angular/directive/collectionRepeat.js
vendored
@@ -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) {
|
||||
|
||||
2
js/angular/directive/refresher.js
vendored
2
js/angular/directive/refresher.js
vendored
@@ -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">' +
|
||||
|
||||
@@ -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);
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user