import { Observable , Observer } from 'rxjs/Rx' ; export class ErrorNotifierService { private errorObservable : Observable < any > ; private errorObserver : Observer < any > ; constructor ( ) { this . errorObservable = Observable . create ( ( observer ) => { this . errorObserver = observer ; } ) . share ( ) ; } notifyError ( error ) { this . errorObserver . next ( error ) ; } onError ( callback ) { this . errorObservable . subscribe ( callback ) ; } }