angular2-http-event
1.0.0 • Public • Published angular2-http-event
simple events center for angular2 http module
Usage
1. add decorator httpEmitter
to http method
import { httpEmitter } from '/path/to/http-event.service';
class demoHttpService() {
constructor(private http: Http) {}
@httpEmitter
query(args) {
return this.http.get().map(response => response.json());
}
}
now this method will emit 'START' and 'FINISH' events.
2. subscribe to http event
import { HttpEventService } from '/path/to/http-event.service';
@Component({...})
class DemoComponent implements OnInit {
constructor(private httpEvent: HttpEventService) {}
ngOnInit() {
this.httpEvent.httpEventCenter.subscribe((type: HttpEventType) => {
});
}
}
Versions
Current Tags
- VersionDownloads (Last 7 Days)
- 1.0.0
1
Version History
- VersionDownloads (Last 7 Days)
- 1.0.0
1
Package Sidebar
Install
npm i angular2-http-event
Weekly Downloads