Reputation: 244
I want to restrict google to only 'address', '(cities)', '(regions)' et remove commercial market name. According to the documentation
types
Type: Array The types of predictions to be returned. Four types are supported: >'establishment' for businesses, 'geocode' for addresses, '(regions)' for >administrative regions and '(cities)' for localities. If nothing is specified, >all types are returned.
But this code return nothing
var options = {
types: ['address', '(cities)', '(regions)']
};
var autocomplete = new google.maps.places.Autocomplete(input, options);
autocomplete.bindTo('bounds', map);
https://jsfiddle.net/7pa4x12L/1/
Upvotes: 2
Views: 1298
Reputation: 17613
You're suppose to specify only one type. As Add Autocomplete for places and addresses says:
In general only a single type is allowed.The exception is that you can safely mix the geocode and establishment types, but note that this will have the same effect as specifying no types
That's why if you check the sample code from Restrict the search to a specific country you can see that there's only one type specified.
var options = {
types: ['(cities)'],
componentRestrictions: {country: 'fr'}
};
You can see more of this in the Autocomplete sample demo.
Upvotes: 1