我有图div。在那个div我给了referesh工具,在客户端控制器中我必须传递参数函数,它将加载数据,然后将删除微调器
$scope.$on('panel-refresh', function(event, id) {
spinnerId=id;
// Instead of timeout you can request a chart data
$scope.loadChart(streamStats, cloudStats);
});
这就是功能
function loadChart(streamStats, cloudStats)
{
streamStats.forEach(function (day)
{
var date = new Date(day._id);
date.setHours(0, 0);
streamSeries.push([date, day.count]);
});
cloudStats.forEach(function (day)
{
cloudSeries.push([new Date(day._id), day.count]);
});
$scope.splineData = [
{
"label": "Data Streams",
"color": "#564aa3",
"data": streamSeries
},
{
"label": "Cloud Syncs",
"color": "#2f80e7",
"data": cloudSeries
}
];
vm.splineData = $scope.splineData;
$scope.$broadcast('removeSpinner', spinnerId);
}
现在问题是我收到此错误
angular.js:13236 ReferenceError: streamStats is not defined
at dashboard.controller.js:43
at Scope.$emit (angular.js:17070)
at HTMLAnchorElement.<anonymous> (panel-refresh.directive.js:42)
at HTMLAnchorElement.dispatch (jquery.js:4732)
at HTMLAnchorElement.elemData.handle (jquery.js:4544)