AngularJS $ timeout循环仅触发一次

ngp*_*und 5 javascript angularjs angularjs-scope

我有以下内容,但我想要做的是$timeout每10秒钟进行一次循环,但是下面的操作是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);
    });
Run Code Online (Sandbox Code Playgroud)

Adr*_*atu 11

你需要的是$ interval,看看这里.