How do you get the markers in the map object / using ui-leaflet

468 Views Asked by At

I'm trying to write a popUp function but I can't seem to figure out how to bind anything to the markers on my map.

<leaflet id="owmMap" event-broadcast="events" center="center" markers="markers" layers="layers"></leaflet>

I've been trying this for a while but it comes back empty

 $scope.markers
2

There are 2 best solutions below

6
On

If I got you right you want to bind the content of your $scope.markers variable to the markers attribut uf your element.

To bind a Variable from the scope to the HTML you need to use interpollation like this:

<leaflet markers={{markers}} />
0
On

Okay, it appears that I was correct and you can access the markers like so $scope.markers. Why it was not working for me, appears to have been when I was was trying to access them on the page. Sorry and thanks to @virth for tying to help.