I am developing an Ionic 2 application using the Javascript Google Maps API.
I added an infowindow and implemented a button on the infoWindow which was to call myFunction() as it is clicked.
I tried the solution in the following question:
I had to make some changes as I am using Ionic and I got a code like this:
addInfoWindow(marker, content){
let infoWindow = new google.maps.InfoWindow({
content: ' ',
});
google.maps.event.addListener(marker, 'click', () => {
infoWindow.setContent('<h4>You are here</h4><button onclick="myFunction()">Click me!</button>');
infoWindow.open(this.map, marker);
});
}
myFunction(){
console.log('clicked');
}
I am getting
Uncaught ReferenceError: myFunction is not defined