kuhnza / angular-google-places-autocomplete

Pure AngularJS directive for Google Places Autocomplete
MIT License
257 stars 188 forks source link

Language selection #109

Closed ohpyupi closed 5 years ago

ohpyupi commented 7 years ago

Is there any possibility to select default language for auto-completing in this package end? My MongoDB app results in error because of mixture of language in text search functionality.

octavioamu commented 7 years ago

well you can add the language you need in the url call as a parameter. ex: https://maps.googleapis.com/maps/api/js?libraries=places&language=en here you have the list of languages With this you can search in your language but results are going to come in the one you choose. "nueva york" is going to suggest "New york" to the user and api also is going to return that.

vbunjes commented 7 years ago

create a options object then use it in your directive init

 $scope.options = {
      componentRestrictions: { country: 'nl' },
      //types: ['geocode']
      types: [$scope.type]
}
 <input type="text"
                   g-places-autocomplete
                   **options="options"**
                   force-selection="true"
                   ng-model="place"
                   placeholder="Zoek op plaats, postcode">