Fetching Data with Get requets | Angular HTTP | Angular 13+

  Рет қаралды 36,898

procademy

procademy

Күн бұрын

In this lecture we will learn how to fetch data from the server and display that data in the web application. To fetch data from the server we use GET request and to send a GET request to the server, we can make use of get() method of HttpClient.
In this lecture you will learn:
1. How to send get request to the server?
2. How to transform the response returned by the server?
3. How to display the response data in the webpage.
DOWNLOAD STARTUP PROJECT HERE: drive.google.c...

Пікірлер: 21
@ShubhamShekhar
@ShubhamShekhar Жыл бұрын
I've explored numerous Angular tutorials, but this one stands out as truly exceptional. The clarity of instruction and depth of content make it a superior learning resource, providing valuable insights and enhancing my understanding of Angular development.
@BrisLS1
@BrisLS1 Жыл бұрын
This was great. I built my copy by using a List component and an Add component, and having Add do an Emit, List then executes a Refresh by getting called through ViewChild. No need for refresh buttons. Best wishes!
@ManojMD-z2t
@ManojMD-z2t Жыл бұрын
just a neat and clean explanation.. i found it wonderful.. thank you sir for the wonderful explanation
@M40A3FengZ
@M40A3FengZ Жыл бұрын
my API return a simple text, in angular, how can i take the result that comes in json and convert to text?
@sachinvarghese2223
@sachinvarghese2223 2 жыл бұрын
Question: In 'onProductCreate()' , i used 'onProductFetch()' method also in method definition, so that when i create a object, it will automatically gets displayed. when compiled, its not working. But when i used a setTimeout() method for 1000ms outside 'onProductFetch()'. its working perfectly. Why it's happening?
@uthjay2331
@uthjay2331 2 жыл бұрын
Hello sir, Is there any other way to view data in html instead of transforming/observable operators ? can we do that using *ngFor directive or forEach method ?
@arundeveloper9041
@arundeveloper9041 2 жыл бұрын
hello sir, if(res.hasOwnProperty(key)){ products.push({...res[key], id:key}); } is the problem, your download source there is no content, it is empty project setup only, please update the full code and give us
@sachinvarghese2223
@sachinvarghese2223 2 жыл бұрын
i think use Object.entries() method instead of for..in loop. I am not sure though if it leads to some error😬 ; especially in case of nested object (sorry , i am noob in coding)
@shivajikoli461
@shivajikoli461 Жыл бұрын
sir , why you didnt use services for http methods which could be more suitable to understand
@kenanhaciyev3759
@kenanhaciyev3759 Жыл бұрын
You are the best)
@vaibhavkutty2511
@vaibhavkutty2511 Жыл бұрын
good morning sir i have tried to add product but i get an error while add new product
@jimshtepa5423
@jimshtepa5423 2 жыл бұрын
thank you for the great educational material and amazing presentation. a quick question: is there any reason for using http instead of fetch api offered by the browser?
@procademy
@procademy 2 жыл бұрын
We can surely use fetch() api from angular. But its better to use angular's built-in http to handle http request and responses. This stackoverflow query might clear your doubt: stackoverflow.com/questions/53660262/angular-http-vs-fetch-api
@juancarlosrivera2874
@juancarlosrivera2874 2 жыл бұрын
Great explanation, but what happened with json data that contains more than one object, i mean like a nested table? thanks for share your knowledge. btw i'm knew with angular, and sorry for my english xd
@procademy
@procademy 2 жыл бұрын
Thank you 😊. To access nested data, you can simply use dot notation. For example, let's say we have following json object: { Name:. "John", Address: { City: "London", Country: "UK" } } Now, if you want to access city field of address, which is a nested JSON object, you can access it like doc.address.city where doc is your variable storing the JSON object.
@deresszakal
@deresszakal Жыл бұрын
Sir, Thx for your great course. I got cors error by the get request. I tried to set the header without success and the Firebase Realtime Database parameter setting failed too. Please help.
@deresszakal
@deresszakal Жыл бұрын
Sorry, I entered the url incorrectly. What confused me was that I got a CORS error. It works now. THX.
@mrcoleman499
@mrcoleman499 2 жыл бұрын
I still receive the error after I change strict to false. Great videos though keep it up!
@sachinvarghese2223
@sachinvarghese2223 2 жыл бұрын
Instead of for..in method ; use this on your own risk (especially incase of nested object 😬) : for (const [key, value] of Object.entries(res)) { products.push({ ...value, id: key }); }; // no need to use hasOwnProperty() method, if we use entries() method
@sajithsampath217
@sajithsampath217 Жыл бұрын
thank you sir
@lakshithakanchana6155
@lakshithakanchana6155 Жыл бұрын
res.hasOwnProperty(key) is useless when it put inside for(const key in res) {}. It will always be true.
Andro, ELMAN, TONI, MONA - Зари (Official Audio)
2:53
RAAVA MUSIC
Рет қаралды 8 МЛН
How to build a REST API with Node js & Express
58:40
Programming with Mosh
Рет қаралды 1,8 МЛН
The RIGHT Way To Use HttpClient In .NET
11:46
Milan Jovanović
Рет қаралды 66 М.
Using Service for HTTP Request | Angular HTTP | Angular 13+
11:49
How to Fetch Data From an API Using Angular - Making a GET Request
10:46
Kindson The Tech Pro
Рет қаралды 92 М.
The Best .NET REST API Client You Didn't Know About
12:55
Milan Jovanović
Рет қаралды 26 М.
Fetching Data in Angular - Do It Correctly
13:50
Monsterlessons Academy
Рет қаралды 19 М.
What is Observable | Observables | Angular 12+
14:16
procademy
Рет қаралды 163 М.