我有以下内容,但我想做的是每 10 秒执行一次 $timeout
循环,但下面的操作是运行 shuffleArray()
然后在 10 秒后它再次触发它,就是这样。到此为止。
$http.post("/content", {"Data":JSON.stringify($scope.content)}).success(function(data, status, header, config){
$scope.ourcontent = data;
shuffleArray($scope.ourcontent);
$timeout(function() {
shuffleArray($scope.ourcontent);
}, 10000);
});
最佳答案
需要的是$interval,看看here .
关于javascript - AngularJS $timeout 循环只触发一次,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24865068/