import { Injectable } from '@angular/core'; import { Subject } from 'rxjs'; @Injectable() export class TimerService { message: any; default: any; private timerObj = new Subject(); tmrMediator = this.timerObj.asObservable(); messageTimer(message: any) { this.timerObj.next(message); } showTimerAction() { this.timerObj.subscribe(result=> { return result; }); } }