angular 6 http get example

Опубликовано: 03 Июнь 2019
на канале: Programming with Karthik
253
1

angular 6 http get example
Complete Playlist:    • Angular 9 Tutorial  

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;

})


Смотрите видео angular 6 http get example онлайн без регистрации, длительностью часов минут секунд в хорошем качестве. Это видео добавил пользователь Programming with Karthik 03 Июнь 2019, не забудьте поделиться им ссылкой с друзьями и знакомыми, на нашем сайте его посмотрели 253 раз и оно понравилось 1 людям.