Skip to content

Commit

Permalink
feat(scroll): adding scroll-complete event to ionScroll
Browse files Browse the repository at this point in the history
  • Loading branch information
dioxmio authored and adamdbradley committed Jun 30, 2016
1 parent 20496d0 commit 34d663e
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions js/angular/directive/scroll.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
* @param {boolean=} paging Whether to scroll with paging.
* @param {expression=} on-refresh Called on pull-to-refresh, triggered by an {@link ionic.directive:ionRefresher}.
* @param {expression=} on-scroll Called whenever the user scrolls.
* @param {expression=} on-scroll-complete Called whenever the scrolling paging is completed.
* @param {boolean=} scrollbar-x Whether to show the horizontal scrollbar. Default true.
* @param {boolean=} scrollbar-y Whether to show the vertical scrollbar. Default true.
* @param {boolean=} zooming Whether to support pinch-to-zoom
Expand Down Expand Up @@ -66,6 +67,7 @@ function($timeout, $controller, $ionicBind, $ionicConfig) {
direction: '@',
paging: '@',
$onScroll: '&onScroll',
$onScrollComplete: '&onScrollComplete',
scroll: '@',
scrollbarX: '@',
scrollbarY: '@',
Expand Down Expand Up @@ -107,18 +109,26 @@ function($timeout, $controller, $ionicBind, $ionicConfig) {
maxZoom: $scope.$eval($scope.maxZoom) || 3,
minZoom: $scope.$eval($scope.minZoom) || 0.5,
preventDefault: true,
nativeScrolling: nativeScrolling
nativeScrolling: nativeScrolling,
scrollingComplete: onScrollComplete
};

if (isPaging) {
scrollViewOptions.speedMultiplier = 0.8;
scrollViewOptions.bouncing = false;
}

$controller('$ionicScroll', {
var scrollCtrl = $controller('$ionicScroll', {
$scope: $scope,
scrollViewOptions: scrollViewOptions
});

function onScrollComplete() {
$scope.$onScrollComplete && $scope.$onScrollComplete({
scrollTop: scrollCtrl.scrollView.__scrollTop,
scrollLeft: scrollCtrl.scrollView.__scrollLeft
});
}
}
}
};
Expand Down

2 comments on commit 34d663e

@ivanovvitaly
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where is is code? I'm using ionic 1.3.1 and I need this peace of code that is really missing

@jakub-g
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ivanovvitaly apparently this was shipped just today as 1.3.2

Please sign in to comment.