Scenario We want the Angular Router to always scroll back to the top of the viewport after navigation. Approach While bootstrapping the app component configure the router like this. const scrollConfig: InMemoryScrollingOptions = {
scrollPositionRestoration: 'top',
anchorScrolling: 'enabled',
};
const inMemoryScrollingFeature: InMemoryScrollingFeature =
withInMemoryScrolling(scrollConfig);
bootstrapApplication(App, {
providers: [provideRouter(routes, inMemoryScrollingFeature)],
});