<router-outlet (activate)="onActivate($event)"></router-outlet> onActivate(event) { // window.scroll(0,0); window.scroll({ top: 0, left: 0, behavior: 'smooth' }); //or document.body.scrollTop = 0; //or document.querySelector('body').scrollTo(0,0) ... }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter