0
I have a function in a file called "mapHelper.js" responsible for adding popups on a map:
     function writeMarker(x,y,msg) {
     var muxiCoordinates = [x,y];
     var muxiMarkerMessage = msg;
     L.marker(muxiCoordinates).addTo(map).bindPopup(muxiMarkerMessage).openPopup();
     }
A controller that allows you to read the database data to $Scope.markers. The data is a list of coordinates and messages "x,y,msg"
angular.module("app",[]);
angular.module("app").controller("appCtrl",function($scope,$http){
    $http.get('/markers').then(function (res) {
        console.log("Got the data");
        $scope.markers=res.data;
    });
});
The question is: how to invoke this function by passing the arguments within $Scope?
I thought of something like:
    div(ng-repeat="marker in markers")
        script.
            writeMarker({{marker.x}},{{marker.y}},{{marker.msg}});
but it doesn’t work.
I’m not sure what your application looks like, but inside
$http.get('/markers').then(function (res) {you could do directlyres.data.forEach(marker => writeMarker(marker.x, marker.y, marker.msg));. You can test that?– Sergio