Changing route doesn’t scroll to top in the new page

I’ve found some undesired, at least for me, behaviour when the route changes.
In the step 11 of the tutorial http://angular.github.io/angular-phonecat/step-11/app/#/phones
you can see the list of phones. If you scroll to the bottom and click on one of the latest, you can see that the scroll isn’t at top, instead is kind of in the middle.

I’ve found this in one of my apps too and I was wondering how can I get this to scroll to the top. I can do it mannually, but I think that there should be other elegant way to do this which I don’t know.

So, is there an elegant way to scroll to the top when the route changes?

18 Answers
18

Leave a Comment