tombatossals / angular-leaflet-directive

AngularJS directive to embed an interact with maps managed by Leaflet library
http://tombatossals.github.io/angular-leaflet-directive
MIT License
1.5k stars 635 forks source link

Marker update of style not heppening #1057

Open muralihr opened 8 years ago

muralihr commented 8 years ago

I am facing two challenges

Problem 1>

The mapbox layer displays the default marker icon - - It is not taking the color from the properties -

But when i put the same in geo json - gist and check it , the colors are displayed properly https://gist.github.com/anonymous/919cd7dd0a817548646d

Problem 2> So i wanted to change the icon in the marker - but the issue is after the ajax call the markers are configured automatically

//$http.get("https://a.tiles.mapbox.com/v4/feelcreative.llm8dpdk/features.json?access_token=pk.eyJ1IjoibXVyYWxpaHI3NyIsImEiOiJjaWo5c2tqZjYwMDNtdXhseGFqeHlsZnQ4In0.W_DdV-qM8lNZzacVotHDEA").success(function(data) { $http.get("api/allGeoTagHeritageEntitysGeoJson").success(function(data) { $scope.geojson.data = data; console.log(data);

     });

2> What do i need to set in the extend section - so that the icons are configured dynamically after reading the properties - In particular my interest is icon url and color properties - with angularjs+leaflet+mapbox ;

angular.extend($scope, { center: { lat: 12.9326189, lng: 77.6733499, zoom: 14 },

         markers: {

         },

         events: {
            markers: {
                enable: ['click'],
                logic: 'emit'
            }
        },
         tiles: {
             name: 'Mapbox Park',
             url: 'http://api.tiles.mapbox.com/v4/{mapid}/{z}/{x}/{y}.png?access_token={apikey}',
             type: 'xyz',
             options: {
                 apikey: 'pk.eyJ1IjoibXVyYWxpaHI3NyIsImEiOiJjaWo5c2tqZjYwMDNtdXhseGFqeHlsZnQ4In0.W_DdV-qM8lNZzacVotHDEA',
                 mapid: 'mapbox.pirates'
             }
         },
         geojson: {}

     });

Thanks