I know it is possible to restrict place to 1 country:
componentRestrictions: {country: "fr"}
But is there a way to restrict to N countries like ["fr", "be"] ?
I know it is possible to restrict place to 1 country:
componentRestrictions: {country: "fr"}
But is there a way to restrict to N countries like ["fr", "be"] ?
componentRestrictions can actually handle up to 5 countries, simply attach the country codes, to an array with 5 Elements.
{ country: ["ch","at","fr","gr","mx"] }
Google itself says: "-componentRestrictions
can be used to restrict results to specific groups. Currently, you can use componentRestrictions
to filter by up to 5 countries. Countries must be passed as as a two-character, ISO 3166-1 Alpha-2 compatible country code. Multiple countries must be passed as a list of country codes." (Find at: https://developers.google.com/maps/documentation/javascript/places-autocomplete )
Note: Question was already answered here: Need multiple country componentRestrictions in Google Places Autocomplete