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' ;
2
3
import { navItems } from './../../_nav' ;
3
4
5
+
4
6
@Component ( {
5
7
selector : 'app-dashboard' ,
6
8
templateUrl : './default-layout.component.html'
@@ -9,17 +11,19 @@ export class DefaultLayoutComponent implements OnDestroy {
9
11
public navItems = navItems ;
10
12
public sidebarMinimized = true ;
11
13
private changes : MutationObserver ;
12
- public element : HTMLElement = document . body ;
13
- constructor ( ) {
14
+ public element : HTMLElement ;
15
+ constructor ( @ Inject ( DOCUMENT ) _document ?: any ) {
14
16
15
17
this . changes = new MutationObserver ( ( mutations ) => {
16
- this . sidebarMinimized = document . body . classList . contains ( 'sidebar-minimized' ) ;
18
+ this . sidebarMinimized = _document . body . classList . contains ( 'sidebar-minimized' ) ;
17
19
} ) ;
18
-
20
+ this . element = _document . body ;
19
21
this . changes . observe ( < Element > this . element , {
20
22
attributes : true ,
21
- attributeFilter : [ 'class' ]
23
+ attributeFilter : [ 'class' ]
22
24
} ) ;
25
+
26
+
23
27
}
24
28
25
29
ngOnDestroy ( ) : void {
You can’t perform that action at this time.
0 commit comments