AngularJS - Restrict Google Autocomplete Country

I use the ion-google-places plugin in my Ionic / Corner application and I want to limit the offer (I want to offer only French places, cities, routes). The problem is that when I click the address, many countries offer (Germany, USA, etc.)

I tried this below, but it does not work ...

This is my HTML:

<ion-google-place placeholder="Lieu" ng-model="event.addressid" geocode-options="geocodeOptions" /> 

This is my JS controller:

 $scope.geocodeOptions = { componentRestrictions: { country : 'FR' } }; 

Repository "ion-google-places": https://github.com/israelidanny/ion-google-place

Thank you all in advance!

+4
source share
1 answer

Try the following:

 var placeName = "new york"; var options = { componentRestrictions: {country: "us"} // <== Country code name }; var autocomplete = new google.maps.places.Autocomplete(placeName, options); 
+1
source

All Articles