Angular - Updating Leopard Heat Map Data
I am using the Angular-Layaflet directive to display a heatmap and I want the data to evolve over time. My code looks like this:
getData().then(function (data) {
$scope.heat.index = 0;
$scope.heat.data = data;
$scope.layers.overlays.heat = {
name: "Heatmap",
type: "heat",
data: $scope.heat.data[$scope.heat.index], // data is a dictionary, not an array
visible: true
};
$scope.$watch('heat.index', function (new_index) {
$scope.layers.overlays.heat.data = $scope.heat.data[new_index];
});
});
However, when I change data.index
(via the slider) nothing happens. What can go on? I know Angular-Leaflet supports this behavior due to this Github issue where someone added it.
+3
source to share