I use Angular and a booklet and want to create a map with different markers, for example: ships and bridges. I want to update them separately, without deleting and setting all the markers again. Therefore, when I got new ships, I just want to name the ship markers, update them, and the bridge markers will remain the same.
Now I tried something like this:
angular.module('angularMapApp') .controller('MainCtrl', ['$scope', 'RequestService', 'setShipMarkers', '$q', function($scope, RequestService, setShipMarkers, $q) { angular.extend($scope, { hamburg: { lat: 53.551086, lng: 9.993682, zoom: 13 }, markers: { ships: { m1: { lat: 42.20133, lng: 2.19110 }, m2: { lat: 42.21133, lng: 2.18110 } }, bridges: { m3: { lat: 42.19133, lng: 2.18110 }, m4: { lat: 42.3, lng: 2.16110 } } }, defaults: { tileLayer: 'http://{s}.tile.openstreetmap.de/tiles/osmde/{z}/{x}/{y}.png', zoomControlPosition: 'topright', tileLayerOptions: { opacity: 0.9, detectRetina: true, reuseTiles: true, }, scrollWheelZoom: false } });
But this does not work, as I get the following error (after setting markers-nested: true in my opinion):
You must add layers to the directive if markers will use this functionality.
However, why do I need layers if I just want to call a group of different markers on the same layer. I just don't want to update them all at once.
So maybe someone can tell me how to get individual groups of markers and how to call them to update them.