How can i use api in ionic?

#1

So im still having a hard time understanding ionic since android studio environment was a bit better and i had some java knowledge…After watching some videos i still cant really understand how to get data from api and display it to a text can someone help?
thanks in advance

#2

If you’re into a heavier IDE experience check out Visual Studio Code, it’s great for Ionic apps.

Anyway, the general idea is that you would make a request to the API endpoint using the HttpClient in Angular, and then subscribe to the response, e.g:

this.http.get('https://example.com/endpoint').subscribe((response) => {
   console.log(response);
});

Then you can do whatever you want with that response in your application. This post might help: https://www.joshmorony.com/integrating-a-backend-with-ionic/

1 Like