How you retrieve specific data from backend in angular | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How you retrieve specific data from backend in angular

The example route given by sololearn localhost:3002/flights/query/city1/city2 is not working for me.

16th Sep 2021, 12:12 PM
Daily Fun Facts
Daily Fun Facts - avatar
1 Answer
+ 1
You can do so by importing the { HttpClient } in your service.ts file Inside the constructor invoke it like this constructor(private http:HttpClient){ } Then the method that does the job should make a get request to your url Example:- getData(){ return this.http.get(your_url) } Then in your app component you can map the data that the method returns.
16th Sep 2021, 2:32 PM
Niththish
Niththish - avatar