For Apps converted from older versions (Angular v2 - v5): HttpModule is now deprecated and you need to replace it with HttpClientModule or else you will get the error too.
import { HttpModule } from '@angular/http';
with the new HttpClientModule import { HttpClientModule} from "@angular/common/http";
Note: Be sure to then update the modules imports[]
array by removing the old HttpModule
and replacing it with the new HttpClientModule
.import { Http } from '@angular/http';
with the new HttpClient import { HttpClient } from '@angular/common/http';
Update how you handle your Http response. For example - If you have code that looks like this
http.get('people.json').subscribe((res:Response) => this.people = res.json());
The above code example will result in an error. We no longer need to parse the response, because it already comes back as JSON in the config object.
The subscription callback copies the data fields into the component's config object, which is data-bound in the component template for display.
For more information please see the - Angular HttpClientModule - Official Documentation