File tree Expand file tree Collapse file tree 1 file changed +10
-6
lines changed
src/app/containers/default-layout Expand file tree Collapse file tree 1 file changed +10
-6
lines changed Original file line number Diff line number Diff line change 1- import { Component , OnDestroy } from '@angular/core' ;
1+ import { Component , OnDestroy , Inject } from '@angular/core' ;
2+ import { DOCUMENT } from '@angular/common' ;
23import { navItems } from './../../_nav' ;
34
5+
46@Component ( {
57 selector : 'app-dashboard' ,
68 templateUrl : './default-layout.component.html'
@@ -9,17 +11,19 @@ export class DefaultLayoutComponent implements OnDestroy {
911 public navItems = navItems ;
1012 public sidebarMinimized = true ;
1113 private changes : MutationObserver ;
12- public element : HTMLElement = document . body ;
13- constructor ( ) {
14+ public element : HTMLElement ;
15+ constructor ( @ Inject ( DOCUMENT ) _document ?: any ) {
1416
1517 this . changes = new MutationObserver ( ( mutations ) => {
16- this . sidebarMinimized = document . body . classList . contains ( 'sidebar-minimized' ) ;
18+ this . sidebarMinimized = _document . body . classList . contains ( 'sidebar-minimized' ) ;
1719 } ) ;
18-
20+ this . element = _document . body ;
1921 this . changes . observe ( < Element > this . element , {
2022 attributes : true ,
21- attributeFilter : [ 'class' ]
23+ attributeFilter : [ 'class' ]
2224 } ) ;
25+
26+
2327 }
2428
2529 ngOnDestroy ( ) : void {
You can’t perform that action at this time.
0 commit comments