rksh
rksh

Reputation: 4050

Leaflet popup with angular js

I've a map that's created with leafletjs. The map has some markers that are like this ev124, ev125 etc.

And there are links that has an attribute called key like <a ng-click="popup(evsi)" key="124">link</a>

I'm using angular for this so i can get my key value by using

$scope.popup= function(evsi){
   var key = evsi.key;
}

Now I have to trigger the click event which is a bultin method for leaflet called openpopup();

$scope.popup= function(evsi){
       var key = evsi.key;
       var maker = "ev" + key;
       maker.openpopup();
    }

However this is not working and gives me an error, Object eve124 has no method 'openpopup'

How can I fix this? I'm new to angular. Thanks

Upvotes: 3

Views: 6014

Answers (1)

mstreffo
mstreffo

Reputation: 805

Have you looked at the events raised when a marker is clicked on? See http://tombatossals.github.io/angular-leaflet-directive/#!/examples/events

Also, you might want to check this post out How to use Angular directives ng-click and ng-class inside Leaflet marker popup if you want to do something more clever.

Upvotes: 1

Related Questions