Page scrolling to top on route change in Angular 2+
Hello everyone! I'm a beginner Angular developer (version 15). I've encountered a problem: when navigating between pages via Router (using `routerLink` in templates and `this.router.navigate()` in components), the page does not scroll to the top. If I'm at the bottom of a long page and navigate to another route, the user sees the middle of the new page instead of its beginning. This is very annoying, especially on mobile devices.
I tried adding `scrollPositionRestoration: 'top'` to the RouterModule configuration, but it didn't work for all cases. I also tried subscribing to Router events in AppComponent and calling `window.scrollTo(0,0)`, but then the scroll happens before the new component fully loads, and visually it looks jerky. I also noticed that if I use