AngularJS + Safari: Force page to scroll to top when pages switch

后端 未结 9 1900
深忆病人
深忆病人 2021-02-07 00:20

I am having an odd, safari-only scrolling behavior using AngularJS.

Whenever the user flips between pages, the pages are being changed as if they are AJAX. I understand

9条回答
  •  独厮守ぢ
    2021-02-07 00:54

    I'd a similar issue with Chrome. However, I don't know if any specific external library is causing this issue or otherwise.

    However I wrote this piece of code at app level and it works.

     $rootScope.$on('$viewContentLoaded', function(){
                    $window.scrollTo(0, 0);
                });
    

提交回复
热议问题