AngularJS $ timeout only works once

I have the following, but what I'm trying to do is loop $timeoutevery 10 seconds, but what is shown below is a start shuffleArray(), after which 10 seconds it starts it again, and this is It. He stops there.

    $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);
    });
+4
source share
1 answer

What you need is $ interval, see here .

+10
source

All Articles