I\'ve been playing with Angular 2 Quickstart.
How can I use/import http module in Angular 2?
I\'ve looked at Angular 2 Todo\'s.js, but it doesn\'t use the ht
For Angular 4.3+, 5.+
// app.module.ts:
import {NgModule} from '@angular/core';
import {BrowserModule} from '@angular/platform-browser';
// Import HttpClientModule from @angular/common/http
import {HttpClientModule} from '@angular/common/http';
@NgModule({
imports: [
BrowserModule,
// Include it under 'imports' in your application module
// after BrowserModule.
HttpClientModule,
],
})
export class MyAppModule {}
And inside your service class
import { HttpClient } from '@angular/common/http';
Other packages you might also need
import { HttpEvent, HttpInterceptor, HttpHandler, HttpRequest, HttpResponse, HttpErrorResponse } from '@angular/common/http';
In package.json
"@angular/http": "^5.1.2",
Reference is here