I’m trying to connect with Google Maps API and make requests for place details specifically. It says I need to make a call to the getDetails() method but I am not sure how to do that. Although I’m great at the templating part of Ember, I’m not great at writing code that allows for making calls to APIs.
Here’s a little context: I’m working on a side project that allows people to search for restaurants based off of a profile that is created. The first stage of it is to be able to implement a simple google search. I have a card layout that I would like to populate with specific data from the API. I hope someone here can help! If I need to clarify more, please let me know
Which step do you need help with? Adding the Google libraries to your app? Figuring out where in your Ember app is the right place to call them?
If you’re starting from the beginning, take a look at https://ember-google-maps.sandydoo.me/ (which I found via Ember Observer). It can automatically add the libraries to your app (including “places”, which is I think the one you need for getDetails.
getDetails is a method on PlacesService. Do you already have an instances of PlacesService?
getDetails takes a placeId as input. Do you already have a placeId?
Whenever you want to use some library that expects to have its HTML elements already in the page before you start calling functions, you can put the HTML into a component’s template and call the API functions from the components’ didInsertElement.
I would suggest starting here and looking through the next several examples to find one that has aspects of what you’re trying to build, and take that code and get it working in your app, using the strategy I outlined above (HTML in a component’s template, Javascript in the component’s didInsertElement). First get their example working as is, then move on to adding the things you want for your app, and ask again when you hit a specific question.