From c241f69d00ac118c915f3eafe1c9af031ae1be57 Mon Sep 17 00:00:00 2001 From: Wesley Cho Date: Sun, 12 Oct 2014 15:57:31 -0700 Subject: [PATCH] perf(infiniteScroll): Use isolate scope - Change to use isolate scope with & binding --- js/angular/directive/infiniteScroll.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/js/angular/directive/infiniteScroll.js b/js/angular/directive/infiniteScroll.js index 1466c1f96d..fd9f916f53 100644 --- a/js/angular/directive/infiniteScroll.js +++ b/js/angular/directive/infiniteScroll.js @@ -72,7 +72,9 @@ IonicModule restrict: 'E', require: ['^$ionicScroll', 'ionInfiniteScroll'], template: '', - 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() {