I use Google Places Autocomplete to present list of predictions to the user while it’s typing.
My requirement is to allow users to pick only addresses that include building number (street_number in API terms).
The configuration I use is shown below:
let gac = new google.maps.places.Autocomplete(
(autocomplete), {
types: ['address'],
componentRestrictions: {'country': ["us"]},
fields: ['formatted_address', 'address_components']
}
);
With this settings user can pick address that includes only Street name without building part specified.
I can add validation message if user picks address without building number (streen_number of an address_componenst arrey, but I would not like to show such results at all.
I studied the list of Types that I can use to restrict results, but didn’t find any better than “address”.
Can someone help to meet my requirements?