scrollToElement blocks scrolling to the top?


I’m adding some code to scroll to a specific entry in a list by default (it’s a list of events, and I want the view to default to the next event…)

When I use “scrollToElement” on one of my list entries, I can no longer scroll back up to older entries before the one I’ve scrolled to. It just does the “pull to refresh” kind of rubber-banding at the location I’ve scrolled to, rather than letting me go back up to the top. Is there a way to change this behavior?


I’ve made a plunker that exhibits this with 0.9.23 and $anchorScroll:


Use $ionicScrollDelegate.anchorScroll() in master. To get the latest version read this:

It’ll be in 0.9.24 release.


I had tried that originally (well, sending the ‘scroll.anchorScroll’ event myself) and I had the same issue.

I’ve updated my plunkr to fix the numeric-id thing (my real code isn’t using numeric IDs, I just did that for convenience in the plunkr) and changed it to use nightly and $ionicScrollDelegate.anchorScroll() and now it starts scrolling down to 500, then scrolls back up to the top.

It appears that the $location.hash() makes it scroll immediately, and then the $ionicScrollDelegate.anchorScroll() call sends it back up to the top.