Sireini
Sireini

Reputation: 4262

angular2-google-maps click-event for marker

Is someone familiar with this library?: https://angular-maps.com/ If so can someone help me creating a click event on the marker i tried this:

 <sebm-google-map-marker *ngFor="#location of locations" (click)="updateDiv()"
[latitude]="location.lat" [longitude]="location.lng" [label]="location.id">

updateDiv() {
console.log('check');
}

But it seems not to work? What am I doing wrong?

Upvotes: 7

Views: 9806

Answers (2)

Thierry Templier
Thierry Templier

Reputation: 202196

I think that you could try the following (markerClick event instead of the click one):

<sebm-google-map-marker *ngFor="#location of locations"   
  (markerClick)="updateDiv()" [latitude]="location.lat"
  [longitude]="location.lng" [label]="location.id">

updateDiv() {
  console.log('check');
}

See this doc in the Outputs section:

Upvotes: 14

yurzui
yurzui

Reputation: 214057

You need to use markerClick instead of click like this:

(markerClick)="updateDiv()"

See also documentation https://angular-maps.com/docs/api/latest/ts/core/SebmGoogleMapMarker-directive.html#Outputs

Upvotes: 4

Related Questions