diff --git a/src/app/app-routes.ts b/src/app/app-routes.ts index 794d532176b..3d5dbbaba45 100644 --- a/src/app/app-routes.ts +++ b/src/app/app-routes.ts @@ -1,7 +1,7 @@ import { - ExtraOptions, - NoPreloading, + InMemoryScrollingOptions, Route, + RouterConfigOptions, } from '@angular/router'; import { NOTIFICATIONS_MODULE_PATH } from './admin/admin-routing-paths'; @@ -261,12 +261,10 @@ export const APP_ROUTES: Route[] = [ ], }, ]; -export const APP_ROUTING_CONF: ExtraOptions = { - // enableTracing: true, - useHash: false, - scrollPositionRestoration: 'enabled', - anchorScrolling: 'enabled', - initialNavigation: 'enabledBlocking', - preloadingStrategy: NoPreloading, +export const APP_ROUTING_CONF: RouterConfigOptions = { onSameUrlNavigation: 'reload', }; +export const APP_ROUTING_SCROLL_CONF: InMemoryScrollingOptions = { + scrollPositionRestoration: 'top', + anchorScrolling: 'enabled', +}; diff --git a/src/app/app.module.ts b/src/app/app.module.ts index d631a1d2525..7876a83c39a 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -10,7 +10,11 @@ import { import { NgModule } from '@angular/core'; import { BrowserModule } from '@angular/platform-browser'; import { + NoPreloading, provideRouter, + withEnabledBlockingInitialNavigation, + withInMemoryScrolling, + withPreloading, withRouterConfig, } from '@angular/router'; import { NgbModule } from '@ng-bootstrap/ng-bootstrap'; @@ -50,6 +54,7 @@ import { import { APP_ROUTES, APP_ROUTING_CONF, + APP_ROUTING_SCROLL_CONF, } from './app-routes'; import { BROWSE_BY_DECORATOR_MAP } from './browse-by/browse-by-switcher/browse-by-decorator'; import { AuthInterceptor } from './core/auth/auth.interceptor'; @@ -103,7 +108,13 @@ const IMPORTS = [ ]; const PROVIDERS = [ - provideRouter(APP_ROUTES, withRouterConfig(APP_ROUTING_CONF)), + provideRouter( + APP_ROUTES, + withRouterConfig(APP_ROUTING_CONF), + withInMemoryScrolling(APP_ROUTING_SCROLL_CONF), + withEnabledBlockingInitialNavigation(), + withPreloading(NoPreloading), + ), { provide: APP_BASE_HREF, useFactory: getBaseHref,