import { Injectable } from '@angular/core' ; import { Observable } from 'rxjs/Observable' ; import { Subject } from 'rxjs/Subject' ; @ Injectable ( ) export class WorksheetService { private selectionFormatState = new Subject < any > ( ) ; setState ( state ) { this . selectionFormatState . next ( state ) ; } getState ( ) { return this . selectionFormatState . asObservable ( ) ; } }