Buggy $ionicScrollDelegate capturing scroll events


#1

I’ve spent the last 2 days trying to get the below event to fire correctly but I’m finding it’s really buggy (using the latest stable release of Ionic). Basically I need to be notified when the user scrolls to certain positions.

The onScoll event “sometimes” works but then other times it doesn’t. I’m currently attaching to it within a Controller and after the enter of the view.

$scope.$on("$ionicView.afterEnter", function(scopes, states) {
$ionicScrollDelegate.getScrollView().onScroll = function() {
console.log(this.$ionicScrollDelegate.getScrollPosition());
}
}

Can someone please advise what might be happening? I’m assuming the “getScrollView” function tries to get the current views scroll.


#2

You might want to see http://codepen.io/anon/pen/rIvah and Detect scroll finish event