I want to add a custom prediction to the list of predictions. But I can’t seem to do so.
let autocomplete, input, predictions;
function initMap()
{
input = document.getElementById('region-input');
const options = {};
autocomplete = new google.maps.places.Autocomplete(input, options);
input.addEventListener('input', function()
{
const value = input.value;
console.log(autocomplete);
const customOption = new google.maps.places.Autocomplete({ name: value });
predictions = autocomplete.getPlacesPredictions();
predictions.unshift(customOption);
});
}
Says TypeError: google.maps.places.AutocompletePlace is not a constructor