Web
Analytics
Example of http get - Tutorial

For Consultation : +91 9887575540

Stay Connected :

Getting Data From Server using http GET Method

We use it to make ajax calls to the server.

The Http class provides the get() method for getting a resource, post() for creating it, put() for updating it, delete() for deleting resource and head() for getting metadata regarding a resource.





Observables

  • Observables is a new primitive type which acts as a blueprint for how we want to create streams, subscribe to them, react to new values, and combine streams together to build new ones.
  • RxJS stands for *R*eactive E*x*tensions for *J*ava*S*cript, and its a library that gives us an implementation of Observables for JavaScript.

Subscribe()

By calling subscribe onto an observable it:

  • 1. Turns the observable hot so it starts producing.
  • 2. Lets us pass in a callback function so we react when anything is pushed onto the final stream in the observable chain.

Example:

Step1: Create a Service., It will create myservice.

ng g service myservice





Step 2 : Create App.Component.ts






Select your currency