Leaflet Map Markers (Color)


#1

Hey All,

Apologies for the redundancy - I believe a post like this is out there somewhere but with no response yet, so I thought I’d post again. I’m using the leaflet map example in an ionic app I’m making, but I can’t seem to modify the marker color on my map. The relevant code is:

map.html

<leaflet defaults="map.defaults" center="map.center" markers="map.markers" ng-if="map"></leaflet>

mapController.js

    $scope.map = {
      defaults: {
        tileLayer: 'http://{s}.tile.osm.org/{z}/{x}/{y}.png',
        maxZoom: 18,
        zoomControlPosition: 'bottomleft'
      },
      markers : {},
      events: {
        map: {
          enable: ['context'],
          logic: 'emit'
        }
      }
    };

// goTo function

 $scope.goTo = function(locationKey) {
    var location = LocationsService.savedLocations[locationKey];
    $scope.map.center  = {
      lat : location.lat,
      lng : location.lng,
      zoom : 16
    };
   
    $scope.map.markers[locationKey] = {
      lat:location.lat,
      lng:location.lng,
      message: "location",
      markerColor: 'purple',
      focus: true,
      draggable: false
    };
  };

For some reason, markerColor isn’t updating the marker color properly. I think it might (hopefully) just be a quick syntax thing. Any help at all would be appreciated!