In Angular 2, the
Http module now by default utilizes the
Observable pattern to wrap
XMLHttpRequest. For developers that are familiar with the pattern, it readily translates to the asynchronous nature of requests to remote resources. For developers that are newer to the pattern, learning the ins and outs of
Http Observables is a good way to wrap your head around this new paradigm.
The code, links, and a live example related to this are available at http://ngcookbook.herokuapp.com/4121.
For the purpose of this example, you'll just serve a static JSON file to the application. However note that this would be no different if you were sending requests to a dynamic API endpoint.
Begin by creating ...