Autoscrolling of ion-view doesn't work on state change when overflow-scroll is true(native scrolling)

When I use native scrolling for my parent view after going back from the child state the scrollTop is set to 0. Where can I change this behavior. I know you can use auto-scroll in ui-view but what is the ionic way to do that.


I have this same question. I have created a demo of the issue here:

Will the save-scroll-on-back feature work for native scrolling in the future?

From this post it looks like autoscroll IS working, but problem is that scrollToTop is being fired right BEFORE the transition, so it looks like the scroll postition gets lost.

Later in the post someone puts a workaround, but I’m having a hard time figuring out how to put this workaround into my app:

Looks like many are having this issue, hopefully someone can find a solution especially since 1.0 just released.

I updated the demo code with the workaround by @benjaminbertin and it now works!


I forgot the injection of $provide in the requirements for the workaround, nice one @elliotwaite :smile:

I am using ionic v.1.1.0
Seems not fixed yet, I still need to use this workaround.

@elliotwaite Thanx for this workaround man! This works for me :smile:

Thanks for the workaround!

It looks like this issue is fixed in the latest codebase. So if you want to patch your ionic.bundle.js file instead of using this workaround, just update this line:

function $LocationDecorator
   if (isDefined(value)) { ...  // << update this line

to this:

   if (isDefined(value) && value.length > 0) { ...

P.S. It would be interesting if someone could work the GitHub blame tool and find the commit?

Issue -
PR -

1 Like