import { Injectable } from '@angular/core' ; import { Subject } from 'rxjs' ; @ Injectable ( ) export class SpinnerService { isLoading = false ; private loadingChange : Subject < boolean > = new Subject < boolean > ( ) ; loadingChange$ = this . loadingChange . asObservable ( ) ; hide ( ) { this . isLoading = false ; this . loadingChange . next ( false ) ; } show ( ) { this . isLoading = true ; this . loadingChange . next ( true ) ; } }