0
我想定期从角度控制器方法发送ajax请求。因为我写了下面的代码。在角度控制器方法中递归调用匿名方法
var mainApp = angular.module('myapp',[]);
mainApp.controller('controller', function($scope,$http,$window,$timeout) {
$('#radioBtn a').on('click', function(){
$http({
method:,
url:,
params:{parameters}
}).then(function(success){
},function(error){
});
$timeout(function(){
//how to call the anonymous function passed to $('#radioBtn a').on() here.
},30000);
});
我没有得到如何从超时函数调用匿名方法。使用this()失败。
他将要在这里注入,而不是$超时$间隔。然而这非常危险。因为每次按下按钮都会触发新的时间间隔。 – MikeOne