Reputation: 3664
ui-router and the 1.4 angular router supported autoscroll="true"
to enable the page to scroll to top of page on navigation to another route. Does anyone know how to do this with the new angular router?
ng-outlet does not appear to have an autoscroll property and the router itself does not appear to have any events I can listen to so I can hook this up manually.
Upvotes: 0
Views: 297
Reputation: 3664
A manual way of doing this is:
$rootScope.$on('$locationChangeSuccess', function() {
document.body.scrollTop = document.documentElement.scrollTop = 0;
});
Upvotes: 1