I use Google autocomplete in a text box and, as a matter of fact, work, select places and type them into text boxes.
The problem is that I only want to fill in the selection name, not the full name + address formatting from the list that is created by the autocomplete list. I can't seem to find a way to override what is in the text box.
var $name = $("#txtName");
$name.focus();
var autocomplete = new google.maps.places.Autocomplete($name[0]);
google.maps.event.addListener(autocomplete, 'place_changed', function () {
var place = autocomplete.getPlace();
$scope.locationData.Name = place.name;
$name.val(place.name);
return false;
});
Basically, what I would like to do is take on the text assignment of the input itself, by performing the assignment itself and causing the autocomplete not to set the value of the text field.
Is it possible?
source
share