monitor-dashboard/src/app/library/sharedComponents/sidebar/sideBar.service.ts

30 lines
675 B
TypeScript
Raw Normal View History

import {Injectable} from "@angular/core";
import {BehaviorSubject, Observable} from "rxjs";
@Injectable({
providedIn: 'root'
})
export class SideBarService {
private openSubject: BehaviorSubject<boolean> = new BehaviorSubject<boolean>(true);
private hasSidebarSubject: BehaviorSubject<boolean> = new BehaviorSubject<boolean>(false);
constructor() {}
get open(): boolean {
return this.openSubject.getValue();
}
setOpen(value: boolean) {
this.openSubject.next(value);
}
get hasSidebar(): Observable<boolean> {
return this.hasSidebarSubject.asObservable();
}
setHasSidebar(value: boolean) {
this.hasSidebarSubject.next(value);
}
}