HTTP Service - Angular (Tutorial #18)

Published: 09 June 2018
on channel: Nisha Singla
35,737
581

HTTP services is the important part of any application which communicates with the server. Most front-end applications communicate with backend services over the HTTP protocol.


Use this link to share video:    • HTTP Service - Angular (Tutorial #18)  

Till Now we are getting a dummy users data but now we want to get live data somewhere from server

Now we require remote data server which provides HTTP Web Service, which we can call using Angular Front End.

You can create Web Service in any language like Java, PHP, .Net or NodeJS.
We can consume this web service using HttpClient in an angular app.

To keep this demo easy to understand by everyone we will consume a FAKE online web service and you can also test at your end easily :

So use this FAKE online REST API :
http://jsonplaceholder.typicode.com/u...

To use HTTP service first step is to enable HTTP Service
.For this we need to include a HttpClientModule in imports array in app.module.ts and this module is defined in library angular/common/http



After this in custom service file (UserService) we need to do Dependency Injection of HttpClient class and with this class make http call using get () method

Angular services return observable in response the way in Angular 1.x it returned promised. Angular services are lazy in nature

Observable are lazy in nature . So if any component want to get Observable it will act like a newspaper. Until unless
you will not subsribe for the newspaper service you will not get that.In same manner until unless you will not subscribe
the Observable you will not call the service .

If you liked my channel , subscribe to it and like my videos. For any queries ask you question in comment section

you can also connect with me @

Facebook:   / angularjs4beginners  
LinkedIn:   / nisha-singla-82407aa0  
Website :


On this page of the site you can watch the video online HTTP Service - Angular (Tutorial #18) with a duration of hours minute second in good quality, which was uploaded by the user Nisha Singla 09 June 2018, share the link with friends and acquaintances, this video has already been watched 35,737 times on youtube and it was liked by 581 viewers. Enjoy your viewing!