File tree Expand file tree Collapse file tree 1 file changed +6
-6
lines changed
packages/devextreme-schematics/src/add-layout/files/src/app/shared/services Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change 1- import { Injectable } from '@angular/core' ;
2-
1+ import { Inject , Injectable } from '@angular/core' ;
2+ import { DOCUMENT } from '@angular/common' ;
33const themes = [ 'light' , 'dark' ] as const ;
44const themeClassNamePrefix = 'dx-swatch-' ;
55
@@ -16,9 +16,9 @@ export class ThemeService {
1616
1717 currentTheme : Theme = getNextTheme ( ) ;
1818
19- constructor ( ) {
20- if ( ! document . body . className . includes ( themeClassNamePrefix ) ) {
21- document . body . classList . add ( themeClassNamePrefix + this . currentTheme ) ;
19+ constructor ( @ Inject ( DOCUMENT ) private document : Document ) {
20+ if ( ! this . document . body . className . includes ( themeClassNamePrefix ) ) {
21+ this . document . body . classList . add ( themeClassNamePrefix + this . currentTheme ) ;
2222 }
2323 }
2424
@@ -27,7 +27,7 @@ export class ThemeService {
2727 const newTheme = getNextTheme ( this . currentTheme ) ;
2828 const isCurrentThemeDark = currentTheme === 'dark' ;
2929
30- document . body . classList . replace (
30+ this . document . body . classList . replace (
3131 themeClassNamePrefix + currentTheme ,
3232 themeClassNamePrefix + newTheme
3333 ) ;
You can’t perform that action at this time.
0 commit comments