diff --git a/src/app/panels/bettermap/module.js b/src/app/panels/bettermap/module.js index c6b070319fa..ef11c47a9b0 100644 --- a/src/app/panels/bettermap/module.js +++ b/src/app/panels/bettermap/module.js @@ -213,14 +213,18 @@ function (angular, app, _, L, localRequire) { layerGroup.clearLayers(); } + var markerList = []; + _.each(scope.data, function(p) { if(!_.isUndefined(p.tooltip) && p.tooltip !== '') { - layerGroup.addLayer(L.marker(p.coordinates).bindLabel(p.tooltip)); + markerList.push(L.marker(p.coordinates).bindLabel(p.tooltip)); } else { - layerGroup.addLayer(L.marker(p.coordinates)); + markerList.push(L.marker(p.coordinates)); } }); + layerGroup.addLayers(markerList); + layerGroup.addTo(map); map.fitBounds(_.pluck(scope.data,'coordinates'));