Skip to content

Commit ebb96f7

Browse files
authored
Merge pull request #14616 from IgniteUI/dpetev/ssr-error-theme-service
SSR error theme service
2 parents fe79ed5 + ae2fc7d commit ebb96f7

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed
Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,16 @@
11
import { ApplicationConfig } from '@angular/core';
2-
import { provideRouter } from '@angular/router';
2+
import { NavigationError, provideRouter, withNavigationErrorHandler } from '@angular/router';
33

44
import { routes } from './app.routes';
55
import { provideClientHydration } from '@angular/platform-browser';
66

77
export const appConfig: ApplicationConfig = {
8-
providers: [provideRouter(routes), provideClientHydration()]
8+
providers: [
9+
provideRouter(
10+
routes,
11+
// force failed routes to throw & fail the SSG part of the build
12+
withNavigationErrorHandler((e: NavigationError) => { throw e; })
13+
),
14+
provideClientHydration()
15+
]
916
};

projects/igniteui-angular/src/lib/services/theme/theme.service.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ export class ThemeService {
3838
}
3939

4040
private init() {
41-
const theme = globalThis
42-
.getComputedStyle(this.document.body)
41+
const theme = globalThis.window
42+
?.getComputedStyle(this.document.body)
4343
.getPropertyValue("--ig-theme")
4444
.trim();
4545

0 commit comments

Comments
 (0)