Add click event to marker ionic native


#1

How can i add a click event to my markers?
I already try this:

 markers[i].on('GoogleMapsEvent.MARKER_CLICK').subscribe(() => {
                                                
 });

but i get this error:

markers[i].on is not a function ; Zone: <root> ; Task: Promise.then ; Value: TypeError: markers[i].on is not a function

My marker objects is this:
__zone_symbol__state:true
__zone_symbol__value:undefined
proto:Object

is right? i added to my markers arrays when this happens:

for (let i = 0; i < locations.length; i++) {
       let latlng: LatLng = new LatLng(locations[i].lat, locations[i].lng);

      let markerOptions: MarkerOptions = {
            position: latlng,
            title: locations[i].id
        };

        const marker: Marker = map.addMarker(markerOptions)
             .then((marker: Marker) => { 
           });
//HERE I ADD MY MARKER TO MARKERS IS OKAY?
        this.markers.push(marker);
      }
 resolve(this.markers);

Also i try:

markers[i].addListener('click', function () {
                                               
 });

But i get:
markers[i].addListener is not a function ; Zone: <root> ; Task: Promise.then ; Value: TypeError: markers[i].addListener is not a function


#2
    //Marker + infowindow + angularjs compiled ng-click
    var contentString = "<div><a ng-click='clickTest()'>Click me!</a></div>";
    var compiled = $compile(contentString)($scope);

    var infowindow = new google.maps.InfoWindow({
      content: compiled[0]
    });

    var marker = new google.maps.Marker({
      position: myLatlng,
      map: map,
      title: 'Uluru (Ayers Rock)'
    });

    google.maps.event.addListener(marker, 'click', function() {
      infowindow.open(map,marker);
    });

#3

I am in ionic 2 and angular 4 that doesnt work for me. Also is the javascript way what you posted. I need the ionic native way using the cordova plugin for google maps