In older versions of ionic I was able to do the following to access the current scroll position:
$ionicScrollDelegate.getScrollView(SCOPE).__scrollTop
How do i do the same with the latest version?
Thanks.
In older versions of ionic I was able to do the following to access the current scroll position:
$ionicScrollDelegate.getScrollView(SCOPE).__scrollTop
How do i do the same with the latest version?
Thanks.
I haven’t used any of the scroll delegates but the best place to find out would be the docs
http://ionicframework.com/docs/api/service/$ionicScrollDelegate/
No luck mhartington. I can’t figure out from the docs how to access the scroll data anymore?
Are you wanting to GET the scroll position or just scroll to the top? In your sample, it looks like you were just telling it to scroll to the top.
If all you really want to do is scroll, then :
$ionicScrollDelegate.scrollTop();
I don’t think it exposes an API for getting the positions though. If you need that, perhaps open a feature request.
I’m looking to get the scroll position, I was able to do it in previous versions. I guess I’ll just downgrade ionic
EDIT: All I needed todo was use ion-scroll instead, it is exposing scrollView via the parent controller.Thanks
Can you post a sample of what you mean?
Would really like to see your sample.
In the mean time, I’ve opened Issue 1117 : https://github.com/driftyco/ionic/issues/1117
FYI : The nightlies expose scroll information again via getScrollView()
along with getScrollPosition()
.
I’m trying to get the scroll position from the top using $ionicScrollDelegate.getScrollPosition().top and all I get is 0. Am I missing something?
See this sample : http://codepen.io/calendee/pen/wygBi
Thank you! I’ve found my mistake: I needed to use $getByHandle because I had more than One ion-scroll container!
Having similar issues using $ionicScrollDelegate.$getByHandle(‘product’).getScrollPosition().top; within a directive. In the browsers, it works fine, but on Android, it returns zero.
same here, do you have any solution?
I found something by myself, it works: