@oitmain/angular2-error-service
TypeScript icon, indicating that this package has built-in type declarations

0.0.5 • Public • Published

import { Subject } from 'rxjs/Subject'; // to emit errors import { Subscription } from 'rxjs/Subscription'; // to subscribe to the emiter

@Component({ ... })

export class MyComponent OnInit, OnDestroy {

private subscription:Subscription = new Subscription();

constructor(
    private errorService: ErrorService,
) {}
ngOnInit(){
    this.subscription = this.errorService.error.subscribe(
        error => console.log(error)
    );
}
ngOnDestroy(){
    this.subscription.unsubscribe();
}

}

Readme

Keywords

none

Package Sidebar

Install

npm i @oitmain/angular2-error-service

Weekly Downloads

2

Version

0.0.5

License

ISC

Last publish

Collaborators

  • oitmain