Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Places autocomplete by lodging and location types

I want Googles autocomplete suggestion to only list lodgings and locations. I've mostly been trying to get the lodging type to work however no suggestions ever appear.

When I remove ac_options from the autoComplete variable everything works fine but ofcourse none of the suggestions are narrowed down by a specific type.

    var ac_options = {
        types: ['lodging']
    };

    var input = document.getElementById(this.options.autoCompleteInputId);
    var autocomplete = new google.maps.places.Autocomplete(input, ac_options);

    //bind to input field
    autocomplete.bindTo('bounds', this.gmap);
like image 852
Malcr001 Avatar asked Apr 23 '13 08:04

Malcr001


1 Answers

I don't think lodging is valid option, as per following link...

https://developers.google.com/maps/documentation/javascript/places#places_autocomplete

You should try following instead...

https://developers.google.com/maps/documentation/javascript/examples/places-queryprediction

in place of "pizza near" in example use "lodging"...:)

like image 72
Dharmesh Patel Avatar answered Sep 28 '22 02:09

Dharmesh Patel