I am using Google Maps autocomplete service, which gives me predictions in a drop down when I start typing in the input box attached to this service.
However, in my app, I am first getting user input on a different page than where the autocomplete input box is. So when the user goes on to the page where autocomplete search box is, I want the user to see input search box already filled out with the input text I collected on the other page and more importantly also show the predictions in the drop down so the user just has to select the one that is correct.
I am able to show the input filled out in the box but not able to show predictions drop down.
I saw that Google Maps has get predictions method which I can store in an array may be. I tried searching for how to create drop down DOM elements from the array items but I could not find a decent answer.
Next thing I tried was simulating a click in the input box programmatically because when I manually click the input box, it drops down with the predictions. I could not make that to work either.
Please help me figure out how I can best go about it.
Here is the HTML, which is connected to Google's autocomplete code in the js file.
HTML
<div class="input-group search-box">
<input id="pac-input" class="form-control controls" type="text"
value="{{ selectedText }}" placeholder="Find a location">
</div>