-
Notifications
You must be signed in to change notification settings - Fork 34
Expand file tree
/
Copy pathapp.component.ts
More file actions
37 lines (28 loc) · 903 Bytes
/
app.component.ts
File metadata and controls
37 lines (28 loc) · 903 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import { Router } from '@angular/router';
import { takeUntil } from 'rxjs/operators';
import { UtilsService } from '@shared/services/utils.service';
import { Component, OnInit, OnDestroy } from '@angular/core';
import { Subject } from 'rxjs';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.scss'],
})
export class AppComponent implements OnInit, OnDestroy {
opened = false;
private destroy$ = new Subject<any>();
constructor(private utilsSvc: UtilsService, private router: Router) {}
closeMenu(): void{
this.utilsSvc.openSidebar(false);
this.router.navigate(['/home']);
}
ngOnInit(): void {
this.utilsSvc.sidebarOpened$
.pipe(takeUntil(this.destroy$))
.subscribe((res: boolean) => (this.opened = res));
}
ngOnDestroy(): void {
this.destroy$.next({});
this.destroy$.complete();
}
}