File

src/app/stores/loader.store.ts

Index

Properties
Methods

Methods

error
error(message: string)
Parameters :
Name Type Optional
message string no
Returns : void
hide
hide()
Returns : void
show
show()
Returns : void
success
success(message: string)
Parameters :
Name Type Optional
message string no
Returns : void

Properties

Public isError$
isError$:
Default value : this.isErrorSource.asObservable()
Private isErrorSource
isErrorSource:
Default value : new BehaviorSubject<string>(null)
Public isSuccess$
isSuccess$:
Default value : this.isSuccessSource.asObservable()
Private isSuccessSource
isSuccessSource:
Default value : new BehaviorSubject<string>(null)
Public isVisible$
isVisible$:
Default value : this.isVisibleSource.asObservable()
Private isVisibleSource
isVisibleSource:
Default value : new BehaviorSubject<boolean>(false)
import { Injectable } from '@angular/core';
import { BehaviorSubject } from 'rxjs/BehaviorSubject';

@Injectable()
export class LoaderStore {
  // Observable sources
  private isVisibleSource = new BehaviorSubject<boolean>(false);
  private isSuccessSource = new BehaviorSubject<string>(null);
  private isErrorSource = new BehaviorSubject<string>(null);
  // Observable streams
  public isVisible$ = this.isVisibleSource.asObservable();
  public isSuccess$ = this.isSuccessSource.asObservable();
  public isError$ = this.isErrorSource.asObservable();

  show() {
    this.isVisibleSource.next(true);
  }

  hide() {
    this.isVisibleSource.next(false);
  }

  success(message: string) {
    this.isSuccessSource.next(message);
  }

  error(message: string) {
    this.isErrorSource.next(message);
  }
}

results matching ""

    No results matching ""