Merge pull request #2390 from wesleycho/perf-infinite-scroll

perf(infiniteScroll): Use isolate scope
This commit is contained in:
Adam Bradley
2014-12-12 15:27:36 -06:00

View File

@@ -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() {