Button Click on InfoWindows Ionic 2


#1

Hey guys, im trying create a infowindow with a click button event, but when i click -> Uncaught ReferenceError: myFunction is not defined

addInfoWindow(marker){

    let infoWindow = new google.maps.InfoWindow({
      content: '<button onclick="myFunction('+id+')">GO!</button>'
    });

    google.maps.event.addListener(marker, 'click', () => {
      infoWindow.open(this.map, marker);
    });
  }
myFunction(id){
  console.log('clicked at ' + id);
}

If anyone can help me with it, I appreciate.

Tank You


#2

Check out that Project


#3

Thank You, I’ll Try it


#4

i updated the project and added the marker click :wink: