There is no error occured but google map is not showing.
actually i want to find near by location.
at first i put the google API key into the index.htm
like that
<script src="http://maps.google.com/maps/api/js?key=AIzaSyAEEC0OzbKyyPEHc-vHUp_bXRVcNEyyl5w&libraries=places"></script>
.ts
initMap() {
let pyrmont = {lat: 22.9868, lng: 87.8550};
this.map = new google.maps.Map(document.getElementById('map'), {
center: pyrmont,
zoom: 15
});
this.infowindow = new google.maps.InfoWindow();
let service = new google.maps.places.PlacesService(this.map);
service.nearbySearch({
location: pyrmont,
radius: 500,
type: ['store']
}, this.callback);
}
callback(results, status) {
if (status === google.maps.places.PlacesServiceStatus.OK) {
for (var i = 0; i < results.length; i++) {
this.createMarker(results[i]);
}
}
}
createMarker(place) {
var placeLoc = place.geometry.location;
var marker = new google.maps.Marker({
map: this.map,
position: place.geometry.location
});
google.maps.event.addListener(marker, 'click', function() {
this.infowindow.setContent(place.name);
this.infowindow.open(this.map, this);
});
}
what i’m wrong? if i’m wrong please tell me how can i fix it.
Thanks in advance.