ng-http
Helper methods for Angular2 HTTP
Usage
ng-http
Install npm i ng-http -S
NgHttpConfig
Define configuration as ;;
NgHttpModule
in root NgModule
Import ...;;;...
HttpClient
in your service/component for usage
Inject ...;;...
Config Interface
- baseUrl: string
- beforeHook: BeforeHookFunction
- afterHook: AfterHookFunction
- errorHook: AfterHookFunction
API
- get(url: string, RequestOptionsArgs?): Observable
- put(url: string, body: string, options? :RequestOptionsArgs): Observable
- post(url: string, body: string, options? :RequestOptionsArgs): Observable
- delete(url: string, RequestOptionsArgs?): Observable
- patch(url: string, body: string, options? :RequestOptionsArgs): Observable
Setup development Environment
Install Peer Dependencies
$ npm i @angular/core @angular/http$ npm i rxjs zone.js reflect-metadata core-js
Install Dev Dependencies
$ npm i
Popup development Environment
npm run start