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

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


$window.scrollTo(0,0) will scroll to the top of the page.

I just found a nice plugin (pure angularJS) that supports animations also:

https://github.com/durated/angular-scroll


you can use this:

.run(["$rootScope", "$window", '$location', function($rootScope, $window,  $location) {    $rootScope.$on('$routeChangeStart', function(evt, absNewUrl, absOldUrl){        $window.scrollTo(0,0);    //scroll to top of page after each route change}}])

or for tab switches you can use the $window.scrollTo(0,0); in your controller


Have you tried using $anchorScroll()? it's documented here.