Forget about using HTTP-PROVIDERS
. Instead, import HttpModule
into your ngModule
and include it in your imports section.
import { HttpModule } from '@angular/http';
@NgModule({
imports: [
...
HttpModule,
],
declarations: [...],
bootstrap: [ .. ],
providers: [ ... ],
})
Always refer to the angular.io website for the latest information. For example, you can find guidance on using Http and all necessary information here.
When working with a service that requires http, make sure to import Http
and inject it into the constructor:
import { Http } from '@angular/http';
// ...
constructor(private http: Http) { }