Project

General

Profile

1
import {BehaviorSubject, Observable} from "rxjs";
2
import { Injectable } from "@angular/core";
3

    
4
@Injectable({
5
  providedIn: 'root'
6
})
7
export class SubscribeService {
8
  
9
  private loading: BehaviorSubject<boolean> = new BehaviorSubject<boolean>(false);
10
  private members: BehaviorSubject<number> = new BehaviorSubject<number>(0);
11
  
12
  public setLoading(loading: boolean) {
13
    this.loading.next(loading);
14
  }
15
  
16
  public setMembers(members: number) {
17
    this.members.next(members);
18
  }
19
  
20
  public getLoading(): Observable<any> {
21
    return this.loading.asObservable();
22
  }
23
  
24
  public getMembers(): Observable<any> {
25
    return this.members.asObservable();
26
  }
27
  
28
}
    (1-1/1)