4

I use plugin "ion-google-places" in my ionic/angularjs App and I want restrict suggest (I want only French places, cities, routes in suggest). The problem is when I tap an address, a lot of countries are suggest (Germany, USA, etc.)

I've try this below but it doesn't work ...

This is my HTML :

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

This is my ControllerJS :

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

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

Thank's all in advance !

PalmThreeStudio
  • 489
  • 8
  • 21
  • I came across the same problem and found this other thread : http://stackoverflow.com/questions/8282026/how-to-limit-google-autocomplete-results-to-city-and-country-only – M. Kejji Mar 09 '16 at 20:52

1 Answers1

1

Try this :

var placeName = "new york";

var options = {
  componentRestrictions: {country: "us"} //  <== Country code name
};

 var autocomplete = new google.maps.places.Autocomplete(placeName, options);
Sangwin Gawande
  • 7,658
  • 8
  • 48
  • 66