You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
748 B
29 lines
748 B
import { Injectable } from '@angular/core';
|
|
import { BehaviorSubject } from 'rxjs';
|
|
|
|
@Injectable({
|
|
providedIn: 'root'
|
|
})
|
|
export class NavbarService {
|
|
private isSearchOpenSubject = new BehaviorSubject<boolean>(false);
|
|
private isNavbarOpenSubject = new BehaviorSubject<boolean>(false);
|
|
|
|
isSearchOpen$ = this.isSearchOpenSubject.asObservable();
|
|
isNavbarOpen$ = this.isNavbarOpenSubject.asObservable();
|
|
|
|
toggleSearch(): void {
|
|
this.isSearchOpenSubject.next(!this.isSearchOpenSubject.value);
|
|
}
|
|
|
|
toggleNavbar(): void {
|
|
this.isNavbarOpenSubject.next(!this.isNavbarOpenSubject.value);
|
|
}
|
|
|
|
onpenNavbar(): void {
|
|
this.isNavbarOpenSubject.next(true);
|
|
}
|
|
|
|
closeNavbar(): void {
|
|
this.isNavbarOpenSubject.next(false);
|
|
}
|
|
}
|