angular 6 http get example Best Practice

Published: 03 June 2019
on channel: Programming with Karthik
181
1

angular 6 http get example Best Practice
Complete Playlist:    • Angular 9 Tutorial  
Angular 9 Tutorial | EP19 | angular http service Part 2 (KINDLY SUBSCRIBE)
This is actually the continuation of session 1 on http Service,
Please find the session 1 on http service :
   • angular 6 http get example  
Recommended to see the above session before seeing this session



In this session we will be discussing about steps need to be done for http service in angular
and a demonstration of a http service(basically try to get employees using the http call "http://localhost:8080/getEmployees") using angular using a node backend server
which is available for download in github:

https://github.com/ksathiya88/node_se...

Download this npm package:

npm i @angular/http

You need to add in the imports of the NgModule in app.module
HttpClientModule


Then you need to inject service HttpClient in the component you need

Constructor should like this:
constructor(public http:HttpClient) {

}


Then in the ngOnInit you can like this and subscribe to receive data


this.http.get("http://localhost:8080/getEmployees").subscribe(
(data) = {
console.log("this",this);
console.log(data);
this.employees=data;

})


On this page of the site you can watch the video online angular 6 http get example Best Practice with a duration of hours minute second in good quality, which was uploaded by the user Programming with Karthik 03 June 2019, share the link with friends and acquaintances, this video has already been watched 181 times on youtube and it was liked by 1 viewers. Enjoy your viewing!