mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
Merge pull request #2390 from wesleycho/perf-infinite-scroll
perf(infiniteScroll): Use isolate scope
This commit is contained in:
8
js/angular/directive/infiniteScroll.js
vendored
8
js/angular/directive/infiniteScroll.js
vendored
@@ -72,7 +72,9 @@ IonicModule
|
||||
restrict: 'E',
|
||||
require: ['^$ionicScroll', 'ionInfiniteScroll'],
|
||||
template: '<i class="icon {{icon()}} icon-refreshing"></i>',
|
||||
scope: true,
|
||||
scope: {
|
||||
load: '&onInfinite'
|
||||
},
|
||||
controller: ['$scope', '$attrs', function($scope, $attrs) {
|
||||
this.isLoading = false;
|
||||
this.scrollView = null; //given by link function
|
||||
@@ -102,7 +104,7 @@ IonicModule
|
||||
var onInfinite = function() {
|
||||
$element[0].classList.add('active');
|
||||
infiniteScrollCtrl.isLoading = true;
|
||||
$scope.$parent && $scope.$parent.$apply($attrs.onInfinite || '');
|
||||
$scope.load();
|
||||
};
|
||||
|
||||
var finishInfiniteScroll = function() {
|
||||
@@ -125,7 +127,7 @@ IonicModule
|
||||
var checkBounds = ionic.animationFrameThrottle(checkInfiniteBounds);
|
||||
|
||||
//Check bounds on start, after scrollView is fully rendered
|
||||
setTimeout(checkBounds);
|
||||
$timeout(checkBounds, 0, false);
|
||||
scrollCtrl.$element.on('scroll', checkBounds);
|
||||
|
||||
function checkInfiniteBounds() {
|
||||
|
||||
Reference in New Issue
Block a user