license import { Injectable } from '@angular/core' ; import { Observable , ReplaySubject } from 'rxjs' ; import { share } from 'rxjs/operators' ; @ Injectable ( ) export class DialogStateService { protected dialogState$ = new ReplaySubject ( ) ; changeDialogState ( state ) { this . dialogState$ . next ( { state } ) ; } onChangeDialogState ( ) { return this . dialogState$ . pipe ( share ( ) ) ; } }