3
我正在使用Angular-Leaflet指令来显示热图,并且我希望数据能够随时间演变。我的代码如下所示:Angular-Leaflet热图数据更新
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];
});
});
但是,当我改变data.index
(通过滑块),没有任何反应。可能会发生什么?我知道Angular-Leaflet支持这种行为,因为this Github issue有人添加了它。