app/core/services/filter-toggler/filter-toggle.service.ts
Used for toggling filter view when hidden in mobile view
Properties |
Methods |
|
constructor()
|
Public closeFilters | ||||||
closeFilters(id: string)
|
||||||
Parameters :
Returns :
void
|
Public showFilters | ||||||
showFilters(id: string)
|
||||||
Parameters :
Returns :
void
|
facetState |
Type : object
|
Default value : {}
|
filterState |
Default value : this.filterTogglerSubject.asObservable()
|
Private filterTogglerSubject |
Default value : new Subject<object>()
|
import { Injectable } from '@angular/core';
import { Subject } from 'rxjs';
/**
* Used for toggling filter view when hidden in mobile view
*/
@Injectable()
export class FilterToggleService {
private filterTogglerSubject = new Subject<object>();
filterState = this.filterTogglerSubject.asObservable();
facetState = {};
constructor() { }
public showFilters(id: string) {
this.facetState[id] = true;
this.filterTogglerSubject.next(this.facetState);
}
public closeFilters(id: string) {
this.facetState[id] = false;
this.filterTogglerSubject.next(this.facetState);
}
}