简体   繁体   中英

Google maps Places API V3 auto-complete search box diff between search term / place selected

I'm using the Google maps Places API V3 auto-complete (google.maps.places.SearchBox) and I added following listener to it :

searchBox = new google.maps.places.SearchBox(input);
     //not available at start, will be set later.
    //updateGoogleAutoCompleteSearchBoundFromMap();
    //listener if the user selected a poi or text
    searchBox.addListener('places_changed', function() {
            ...

So I'm wondering now the search box gives me concrete places and then search term auto-complete. No matter what I choose in the list, I get an array with places object with a places id. Can I differentiate somehow if a user selected a search term or a concrete places id?

Because I would like to act different then. I couldn't find anything in the documentation so I'm afraid I'm not able to differentiate....

Because if the user picks a concrete place, I want to show that place and only that place. If not, I would like to use the search term for something else.

I still dont really know why the autocomplete acts differenet on some of my machines. But i figured out it was actually pretty simple since they array size is always 1 when you pick a place and >1 if you pick a text. So thanks anyways

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM