How do I get my text to continiously change based on the result of a httprequest until end condition is met?

I am a bit of an angular newbie. I basically need to update a piece of text with progress information until a task has completed. I want to do this by having angular request the update text every 5 seconds.

My resource call looks like this:

getPublishProgress: function () {
            return $http.get("backoffice/Approval/ApprovalApi/GetPublishProgress");

In my controller I can do it once, like this:

awaitingResource.getPublishProgress().then(function (response) { $scope.publishProgress = });

So what I want to do is run that code in my controller every 5 seconds without locking up the page (the message will have specific text to indicate that the polling should be stopped).

How do I do this with Angular.Js?


I think everything you need here - is to figure out how to implement long poll request in angularJS. Here is JS Fiddle example.

$scope.publishProgress = "";
var poll = function() {
    $timeout(function() {
        awaitingResource.getPublishProgress().then(function (response) { 
           $scope.publishProgress =
    }, 5000);

If you will need additional information, leave a comment. Hope it will help you!

Need Your Help

JsonMappingException: How to transfert a Objectify Entity (with Key) through Restlet

json restlet objectify restlet-2.0

I am developping an Android Application, comunicating with a GAE server + Objectify DB.

What is causing the line break?

html css line-breaks

I am working on a blog: If you check the link you can see that currently the blog posts are just below the thumbnail. Now I am trying to make the blog...