AngularJS – 限制Google自动完成中的国家/地区

前端之家收集整理的这篇文章主要介绍了AngularJS – 限制Google自动完成中的国家/地区前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我在我的离子/ angularjs应用程序中使用插件“ion-google-places”,我想要限制建议(我只想要法国地方,城市,建议中的路线).
问题是当我点击地址时,很多国家都建议(德国,美国等)

我在下面试试这个,但它不起作用……

这是我的HTML

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

这是我的ControllerJS:

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

“ion-google-places”回购:https://github.com/israelidanny/ion-google-place

谢谢所有提前!

解决方法

试试这个 :

var placeName = "new york";

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

 var autocomplete = new google.maps.places.Autocomplete(placeName,options);

猜你在找的Angularjs相关文章