I am following this fundamental tutorial on Angular about Http.
As one can see in the \"Setup: Installing the module\" section, they import the HttpClientModule as f
Refer to this: http: deprecate @angular/http in favor of @angular/common/http.
Is this issue resolved.
I am getting this error: ERROR in node_modules/ngx-restangular/lib/ngx-restangular-http.d.ts(3,27): error TS2307: Cannot find module '@angular/common/http/src/response'.
After updating my angular to version=8
Important Update:
HttpModule and Http from @angular/http has been deprecated since Angular V5, should of using HttpClientModule and HttpClient from @angular/common/http instead, refer CHANGELOG.
For Angular version previous from **@4.3.0, You should inject Http from @angular/http, and HttpModule is for importing at your NgModule's import array.
import {HttpModule} from '@angular/http';
@NgModule({
...
imports: [HttpModule]
})
Inject http at component or service
import { Http } from '@angular/http';
constructor(private http: Http) {}
For Angular version after(include) 4.3.0, you can use HttpClient from @angular/common/http instead of Http from @angular/http. Don't forget to import HttpClientModule at your NgModule's import array first.
Refer @echonax's answer.