Prevent on-scroll event from firing with ng-click


#1

Any ideas on preventing on-scroll from firing from ng-click event.
Open the console on the codepen below and when you click you’ll see the scrollPosition().top value is logged. What I’m trying to achieve is an interface that shows the ion-footer-bar on ng-click and then after the user starts scrolling I want to animate the ion-footer-bar out of view. I can achieve this if I could just prevent the click from triggering on-scroll, however I’m open to alternative solutions. Thanks!

See the Pen List: Nightly by Brad Martin (@bradmartin) on CodePen.


#2

Don’t know if there’s a way to prevent this from occurring but I found a solution for my app by setting a $scope variable = getScrollPosition().top when ng-click happens.

Then in the on-scroll function I just check equality.

  $scope.scrollMe = function () {
    var scrollTop = $ionicScrollDelegate.getScrollPosition().top;
    if ($scope.lastScrollTopPosition !== undefined) {
        if ($scope.lastScrollTopPosition !== scrollTop) {
            $scope.closeMsgFooter();
        };
    };        
};