Skip to content

Commit

Permalink
Merge pull request #2390 from wesleycho/perf-infinite-scroll
Browse files Browse the repository at this point in the history
perf(infiniteScroll): Use isolate scope
  • Loading branch information
adamdbradley committed Dec 12, 2014
2 parents 9f437a8 + c241f69 commit 6eb7eb1
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions js/angular/directive/infiniteScroll.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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() {
Expand All @@ -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() {
Expand Down

0 comments on commit 6eb7eb1

Please sign in to comment.