Skip to content

Commit 6704a39

Browse files
committed
[DURACOM-191] Provide routing option properly
1 parent 8529257 commit 6704a39

2 files changed

Lines changed: 19 additions & 10 deletions

File tree

src/app/app-routes.ts

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import {
2-
ExtraOptions,
3-
NoPreloading,
2+
InMemoryScrollingOptions,
43
Route,
4+
RouterConfigOptions,
55
} from '@angular/router';
66

77
import { NOTIFICATIONS_MODULE_PATH } from './admin/admin-routing-paths';
@@ -261,12 +261,10 @@ export const APP_ROUTES: Route[] = [
261261
],
262262
},
263263
];
264-
export const APP_ROUTING_CONF: ExtraOptions = {
265-
// enableTracing: true,
266-
useHash: false,
267-
scrollPositionRestoration: 'enabled',
268-
anchorScrolling: 'enabled',
269-
initialNavigation: 'enabledBlocking',
270-
preloadingStrategy: NoPreloading,
264+
export const APP_ROUTING_CONF: RouterConfigOptions = {
271265
onSameUrlNavigation: 'reload',
272266
};
267+
export const APP_ROUTING_SCROLL_CONF: InMemoryScrollingOptions = {
268+
scrollPositionRestoration: 'top',
269+
anchorScrolling: 'enabled',
270+
};

src/app/app.module.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,11 @@ import {
1010
import { NgModule } from '@angular/core';
1111
import { BrowserModule } from '@angular/platform-browser';
1212
import {
13+
NoPreloading,
1314
provideRouter,
15+
withEnabledBlockingInitialNavigation,
16+
withInMemoryScrolling,
17+
withPreloading,
1418
withRouterConfig,
1519
} from '@angular/router';
1620
import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
@@ -50,6 +54,7 @@ import {
5054
import {
5155
APP_ROUTES,
5256
APP_ROUTING_CONF,
57+
APP_ROUTING_SCROLL_CONF,
5358
} from './app-routes';
5459
import { BROWSE_BY_DECORATOR_MAP } from './browse-by/browse-by-switcher/browse-by-decorator';
5560
import { AuthInterceptor } from './core/auth/auth.interceptor';
@@ -103,7 +108,13 @@ const IMPORTS = [
103108
];
104109

105110
const PROVIDERS = [
106-
provideRouter(APP_ROUTES, withRouterConfig(APP_ROUTING_CONF)),
111+
provideRouter(
112+
APP_ROUTES,
113+
withRouterConfig(APP_ROUTING_CONF),
114+
withInMemoryScrolling(APP_ROUTING_SCROLL_CONF),
115+
withEnabledBlockingInitialNavigation(),
116+
withPreloading(NoPreloading),
117+
),
107118
{
108119
provide: APP_BASE_HREF,
109120
useFactory: getBaseHref,

0 commit comments

Comments
 (0)