Search Posts

Category: leaflet

Using $compile on a html string only returns first line

I’m working on a leaflet map that contains markers. I’m using angular.js. I want to bind a popup to each marker which contain information about the marker. If you click on the marker name it should call a function. This is my .js : var boreholePopup = (‘<a ng-click=”boreholeMarkerClicked(‘ + $scope.boreholes[i] + ‘)”>’ + $scope.boreholes[i].boreholeName + “</a><br>Elevation: ” + $scope.boreholes[i].boreholeName + “m<br>Type: ” + $scope.boreholes[i].boreholeName); var compiled = $compile(boreholePopup)($scope); console.log(‘compiled’, compiled); boreholeMarker .bindPopup(compiled[0]) .on(‘mouseover’, function(e) […]