Add custom prediction to Google Maps Places Autocomplete

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

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.