import {Http, HTTP_PROVIDERS} from '@angular/http';
When I use http
I get a error that "No provider for Http",
then I import HTTP_PROVIDERS
but HTTP_PROVIDERS has no exported member
I have created plunker on inserting http. Read more about http module
import {HttpClientModule} from '@angular/common/http';
@NgModule({
imports: [ BrowserModule, HttpClientModule ],
declarations: [ App ],
bootstrap: [ App ]
})
export class AppModule {}
HTTP_PROVIDERS was deprecated in current version. But which verions of angular cli, angular compiler, and angular core do you use? in latest version, you have to use this:
/* in app.module.ts */
import { HttpModule } from '@angular/http';
@NgModule({
imports: [BrowserModule, HttpModule],
....
}