我只希望通过ngAutocomplete显示所有“INDIA”城市.. ???我必须在ngAutocomplete中进行哪些更改..?

时间:2017-03-29 09:57:55

标签: google-maps

我只想通过ngAutocomplete.js向所有印度城市提供选项......远低于ngAutocomplete.js的代码

android {
   ...
   defaultConfig {...}
   buildTypes {...}
   productFlavors {
       tablet {
           applicationIdSuffix ".tablet"
           versionNameSuffix "-tablet"
       }
       phone {
           applicationIdSuffix ".phone "
           versionNameSuffix "-phone "
       }
   }

2 个答案:

答案 0 :(得分:1)

幸运的是,Google JS文档中有Autocomplete: Restrict the search to a specific country。此功能使用componentRestrictions选项将自动完成搜索限制为特定国家/地区。这是给你的片段:

 var input = document.getElementById('searchTextField');
var options = {
  types: ['(cities)'],
  componentRestrictions: {country: 'in'}
};

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

以下是Google地图示例中的full working demo

答案 1 :(得分:0)

            $scope.getOnlyINDIA = {
                      country: 'in', 
                      types: '(cities)'
                       };

将其添加到控制器中,然后添加到自动完成文本框添加...

           options="getOnlyINDIA"