我需要在angularjs中将变量传递给$scope.start = function(host_id) {
// store the interval promise
$scope[`promise_${host_id}`] = $interval(function(host_id){
$scope.update_status(host_id)
}, 3000);
};
// stops the interval
$scope.stop = function(host_id) {
$interval.cancel($scope[`promise_${host_id}`]);
};
,并在间隔之后返回到另一个函数
示例:
$scope.start(5);
{{1}}