I'm trying to dynamically add multiple GeoJSON data to my map. as shown below. However I don't see the data getting rendered.
$http.get("/kp-data").success(function(data, status){
angular.forEach(data, function(k,v){
$scope.geojson[k.carId] = {data : k.data,
resetStyleOnMouseout: true,
style: {
fillColor: k.color,
weight: 2,
opacity: 1,
color: 'white',
dashArray: '3',
fillOpacity: 0.7
}
}
});
In this example the geojson data USA and JPN is hardcoded. I modified the code for dynamic addition. The code works if I modified as below for a single geojson data
$http.get("/kp-data").success(function(data, status){
angular.forEach(data, function(k,v){
if(v==1){
$scope.geojson = {data : k.data,
resetStyleOnMouseout: true,
style: {
fillColor: k.color,
weight: 2,
opacity: 1,
color: 'white',
dashArray: '3',
fillOpacity: 0.7
}
}
}
});