JavaScript Edu Resources. Angular Courses. React Tutorials. Join us!


Http is available as an injectable class, with methods to perform http requests. Calling request returns an EventEmitter which will emit a single Response when a response is received.

  • In this post I will show a quick demo of how to make requests using the Angular http module.
  • Below is a simple example where I load a list of friends from a json file:

    Via the subscribe function the code reacts to the result of the asynchronous request and deserializes the returned json into an object.

  • The code below shows how to use the Subject to trigger a country change and a subsequent http call to get the capitol of that specific country.
  • With just a few lines of code we have added a safeguard into our application that will ensure that we don’t have to worry about out of order http requests.
  • Here is a quick sample where I show how to make an http request using a promise.

Angular and Http

Comments are closed, but trackbacks and pingbacks are open.