import {BehaviorSubject, Observable} from "rxjs"; import { Injectable } from "@angular/core"; @Injectable({ providedIn: 'root' }) export class SubscribeService { private loading: BehaviorSubject = new BehaviorSubject(false); private members: BehaviorSubject = new BehaviorSubject(0); public setLoading(loading: boolean) { this.loading.next(loading); } public setMembers(members: number) { this.members.next(members); } public getLoading(): Observable { return this.loading.asObservable(); } public getMembers(): Observable { return this.members.asObservable(); } }