Google map is integrated the javascript way and I want to call a angular2 function inside an infowindow like the following code. Take a look at infoContent
for the
Please try this complete solution for this question.
var infowindow = new google.maps.InfoWindow({});
for (i = 0; i < locations.length; i++) {
let locLatLng = new google.maps.LatLng(locations[i].latitude, locations[i].longitude);
let infoContent = '' +
''+locations[i].id +'
'+
''+
''
marker = new google.maps.Marker({
position: locLatLng,
map: this.map
});
google.maps.event.addListener(marker, 'click', (function(marker, i) {
return function() {
infowindow.setContent(infoContent);
infowindow.open(this.map, marker);
};
})(marker, i));
}
infowindow.addListener('domready', () => {
var val = document.getElementById('lt').innerHTML;
document.getElementById("btn").addEventListener("click", () => {
this.myFunction(val);
});
});