Dependencies
main.ts file
I want to import HTTP_PROVIDERS
but is is giving me error that
"@angular/http/index has no exported member of HTTP_PROVIDERS"
I have attached images of package.json and main.ts file.
HTTP-PROVIDERS
is not used anymore. Import HttpModule
to your ngModule
instead and add it to your imports.
import { HttpModule } from '@angular/http';
@NgModule({
imports: [
...
HttpModule,
],
declarations: [...],
bootstrap: [ .. ],
providers: [ ... ],
})
I suggest you always check angular.io page for current info. E.g, here usage of Http and everything that's needed is described :)
In the service you want to use http, you import Http
and inject it in your constructor:
import { Http } from '@angular/http';
// ...
constructor(private http: Http) { }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With