Skip to content

Commit 4b59e2c

Browse files
committed
2 parents 9bad398 + 88ea2db commit 4b59e2c

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

src/app/containers/default-layout/default-layout.component.ts

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
import {Component, OnDestroy} from '@angular/core';
1+
import { Component, OnDestroy, Inject } from '@angular/core';
2+
import { DOCUMENT } from '@angular/common';
23
import { 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 {

0 commit comments

Comments
 (0)