Closed masaruduy closed 4 years ago
@masaruduy
Currently there is no way to pass this option in without modifying the package. However, I was able to achieve this by modifying the address.js
file.
Here's the line in question.
Add the countries you want to a country property like this:
$(function () {
$('input.address').each(function () {
var self = $(this);
var cmps = $('#' + self.attr('name') + '_components');
var fmtd = $('input[name="' + self.attr('name') + '_formatted"]');
self.geocomplete({
**country: ['IT', 'US'],**
details: cmps,
detailsAttribute: 'data-geo'
...
And you get only those countries:
I'm closing this for now, but if it comes up again we can look at adding it as a feature.
Thanks for you great app you made.
Is there a way to restrict the autocomplete results to certain countries? I've found this setting on https://developers.google.com/maps/documentation/javascript/examples/places-autocomplete-multiple-countries: autocomplete.setComponentRestrictions( {'country': ['us', 'pr', 'vi', 'gu', 'mp']});
Not sure how it could be used together with your code though. Can you please advise?
Thanks!