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?

1

1 Answer 1

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.

Sign up to request clarification or add additional context in comments.

1 Comment

I replaced my Http with the newer HttpClient. Thanks.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.