I just made two important upgrades to our Angular 4 application and build tools:
^4.1.3 => ^4.2.4 (and /http,
HttpClientThe new syntax to be compatible with HttpClient, introduced in angular 4.3, is:
import { HttpClient, HttpHeaders } from "@angular/common/http";
private _options = { headers: new HttpHeaders({ 'Content-Type': 'application/json' }) };
No more RequestOptions: parameters are added using the new immutable HttpParams Map.
HttpI just noticed that RequestOptions now requires you to explicitly pass named options as an object, like:
headers: Headers = new Headers({ 'Content-Type': 'application/json' });
options: RequestOptions = new RequestOptions({ headers: this.headers });