需要注意调用interval()参数内写 function(){},delay:
autoRefresh = $interval(function (){
.........
}, delay);
//自动刷新,刷新间隔10min,离开页面则取消自动刷新
var autoRefresh;
autoRefresh = $interval(function (){
getData($scope.currentViewType,$scope.currentPeriod,$scope.statusFiler)
}, 600000);
$scope.stopAutoRefresh = function () {
if (autoRefresh) {
$interval.cancel(autoRefresh);
autoRefresh = null;
}
};
$scope.$on('$destroy', function (angularEvent, current,) {
$scope.stopAutoRefresh();
});