【问题标题】:AngularJS - Restrict Country in Google AutoCompleteAngularJS - 在谷歌自动完成中限制国家
【发布时间】:2015-10-23 10:52:27
【问题描述】:

我在我的 ionic/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

先谢谢大家了!

【问题讨论】:

标签: angularjs google-maps ionic-framework


【解决方案1】:

试试这个:

var placeName = "new york";

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

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

【讨论】:

    猜你喜欢
    • 2017-12-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-01-07
    • 1970-01-01
    • 2013-03-18
    • 1970-01-01
    相关资源
    最近更新 更多