Я пытаюсь получить информацию о магазинах, используя Angular google maps.Я использую API мест Google и его PlacesService.Код ниже и моя карта включена в index.html
searchNearby(lat: any, lng: any) {
const locationOf = new google.maps.LatLng(lat, lng);
const requestObj = {
location: locationOf,
name: 'Tesco',
radius: 10000,
type: 'store',
};
// const map = document.getElementsBy('sebm-google-map-container')[0] as HTMLDivElement;
const service = new google.maps.places.PlacesService(document.getElementById('output') as HTMLDivElement);
service.nearbySearch(requestObj, (results, status) => {
console.log('Retrieved data:');
console.log(results);
});
}
<script async defer src="https://maps.googleapis.com/maps/api/js?key=<api_key>&libraries=places">
</script>
Это ошибка, которую я получаю.
core.js:6014 ERROR Error: Uncaught (in promise): TypeError: Cannot read property 'innerHTML' of null
TypeError: Невозможно прочитать свойство 'innerHTML' с нулевым значением
Может кто-нибудь помочь, пожалуйста ??