I have a function in a file called "mapHelper.js" responsible for adding popups to 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 lets you read data from the database 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 arguments within $ Scope?
I thought of something like:
div(ng-repeat="marker in markers") script. writeMarker({{marker.x}},{{marker.y}},{{marker.msg}});
but does not work.