Using Modal IonicScrollDelegate.get position always return 0

@Calendee @mhartington @max
I am having an issue that I am getting the scroll position using ionic $ionicScrollDelegate.getScrollPosition() it works fine as in this demo http://codepen.io/asadfida/pen/HvDtb

But when I add a ionic modal screen in my project it does not work as in this demo http://codepen.io/asadfida/pen/JKiqI

Scroll works but $ionicScrollDelegate.getScrollPosition().top() always returns 0.

It will work if you remove the modal code from the controller or remove the modal screen from the template.

I have wasted a lot of time in troubleshooting it but still no success.
Please help me!
Thanks for reading…

Hey there :smile:

So I got it to work by conditionally show/hiding the content directive inside the modal, based on when ever the modal is open/closed.

UPDATE:

So a less of a hacky way to get it to work right is to use the delegate-handle.

1 Like

Thank you @mhartington :blush:

My problem is that $ionicScrollDelegate.getScrollPosition().top always return 0 after deploy to a mobile device, works fine with Chrome browser. any idea?

  <ion-view hide-back-button="true">
 <ion-content has-bouncing="true" class="has-header has-subheader" id="store-container" on-scroll="onScoll()">
 </ion-content>

.controller('HomeStoresCtrl', function($state, $ionicScrollDelegate, ...
     $scope.onScoll = function() {
         console.log($ionicScrollDelegate.getScrollPosition().top)
    }

Any resolution to this issue?

this if it works but if I go straight to the view, but if I come from another view that does not work and retrna 0

+1 Same issue, not working if navigated from other view… Any resolution for this so far?

Update–

Working now, Used the scroll-delegate directive in the Ion-content tag and this works like a charm.

Also see