[DURACOM-191] Provide routing option properly

This commit is contained in:
Giuseppe Digilio
2024-03-20 11:56:53 +01:00
parent 85292579af
commit 6704a397bd
2 changed files with 19 additions and 10 deletions

View File

@@ -1,7 +1,7 @@
import { import {
ExtraOptions, InMemoryScrollingOptions,
NoPreloading,
Route, Route,
RouterConfigOptions,
} from '@angular/router'; } from '@angular/router';
import { NOTIFICATIONS_MODULE_PATH } from './admin/admin-routing-paths'; import { NOTIFICATIONS_MODULE_PATH } from './admin/admin-routing-paths';
@@ -261,12 +261,10 @@ export const APP_ROUTES: Route[] = [
], ],
}, },
]; ];
export const APP_ROUTING_CONF: ExtraOptions = { export const APP_ROUTING_CONF: RouterConfigOptions = {
// enableTracing: true,
useHash: false,
scrollPositionRestoration: 'enabled',
anchorScrolling: 'enabled',
initialNavigation: 'enabledBlocking',
preloadingStrategy: NoPreloading,
onSameUrlNavigation: 'reload', onSameUrlNavigation: 'reload',
}; };
export const APP_ROUTING_SCROLL_CONF: InMemoryScrollingOptions = {
scrollPositionRestoration: 'top',
anchorScrolling: 'enabled',
};

View File

@@ -10,7 +10,11 @@ import {
import { NgModule } from '@angular/core'; import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser'; import { BrowserModule } from '@angular/platform-browser';
import { import {
NoPreloading,
provideRouter, provideRouter,
withEnabledBlockingInitialNavigation,
withInMemoryScrolling,
withPreloading,
withRouterConfig, withRouterConfig,
} from '@angular/router'; } from '@angular/router';
import { NgbModule } from '@ng-bootstrap/ng-bootstrap'; import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
@@ -50,6 +54,7 @@ import {
import { import {
APP_ROUTES, APP_ROUTES,
APP_ROUTING_CONF, APP_ROUTING_CONF,
APP_ROUTING_SCROLL_CONF,
} from './app-routes'; } from './app-routes';
import { BROWSE_BY_DECORATOR_MAP } from './browse-by/browse-by-switcher/browse-by-decorator'; import { BROWSE_BY_DECORATOR_MAP } from './browse-by/browse-by-switcher/browse-by-decorator';
import { AuthInterceptor } from './core/auth/auth.interceptor'; import { AuthInterceptor } from './core/auth/auth.interceptor';
@@ -103,7 +108,13 @@ const IMPORTS = [
]; ];
const PROVIDERS = [ 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, provide: APP_BASE_HREF,
useFactory: getBaseHref, useFactory: getBaseHref,