perf(infiniteScroll): Use isolate scope

- Change to use isolate scope with & binding
This commit is contained in:
Wesley Cho
2014-10-12 15:57:31 -07:00
parent ea36d71b77
commit c241f69d00

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