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

后端 未结 18 2050
北恋
北恋 2020-11-29 15:11

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/#/phon

18条回答
  •  栀梦
    栀梦 (楼主)
    2020-11-29 15:25

    FYI for for anyone coming across the problem described in the title (as I did) who is also using the AngularUI Router plugin...

    As asked and answered in this SO question, the angular-ui router jumps to the bottom of the page when you change routes.
    Can't figure out why page loads at bottom? Angular UI-Router autoscroll Issue

    However, as the answer states, you can turn off this behavior by saying autoscroll="false" on your ui-view.

    For example:

    http://angular-ui.github.io/ui-router/site/#/api/ui.router.state.directive:ui-view

提交回复
热议问题