Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 202
Sireini Avatar asked May 26 '16 14:05

Sireini


2 Answers

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:

  • https://angular-maps.com/docs/api/latest/ts/core/SebmGoogleMapMarker-directive.html
like image 187
Thierry Templier Avatar answered Oct 03 '22 08:10

Thierry Templier


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

like image 24
yurzui Avatar answered Oct 03 '22 07:10

yurzui