angular scroll to top when new page code example
Example 1: angular scroll to top
scrollToTop(){
window.scroll(0,0);
}
Example 2: angular route change scroll to top
RouterModule.forRoot(appRoutes, { scrollPositionRestoration: 'enabled' })
scrollToTop(){
window.scroll(0,0);
}
RouterModule.forRoot(appRoutes, { scrollPositionRestoration: 'enabled' })