29

I am new in Angular2 and I am learning to make http calls.

I have found Angular2 has these two modules:

HttpModule from @angular/http

and

HttpClientModule from @angular/common/http

and they both support http calls.

However I don't figure out the difference between them.

Does anyone know about this?

Sangwin Gawande
  • 7,658
  • 8
  • 48
  • 66
Judah Flynn
  • 544
  • 1
  • 8
  • 20
  • 2
    Possible duplicate of [Difference between HTTP and HTTPClient in angular 4?](https://stackoverflow.com/questions/45129790/difference-between-http-and-httpclient-in-angular-4) – Estus Flask Jul 31 '17 at 00:52

1 Answers1

47

HttpClient is a new API that came with 4.3, it has updated API's with support for progress events, json deserialization by default, Interceptors and many other great features. See more here https://angular.io/guide/http

Http is the older API and will eventually be deprecated.

Since their usage is very similar for basic tasks I would advise using HttpClient since it is the more modern and easy to use alternative.

Toxicable
  • 1,639
  • 2
  • 21
  • 29