Hey Nicolas,
I'd suggest making a variable before you run these requests that's
defaulted to false;
var progressFinished = false;
Just have it switched to true during progress's callback.
While these are all running just run a simple for loop testing if it's true.
var stop = $interval(function () {
if (!isProgressFinished) {
// do whatever you want
}
}, 300); // every 3 seconds
I think something like that would do the trick.
-Mark
On Wednesday, February 11, 2015 at 8:40:36 AM UTC-5, Nicolas Vacelet wrote:
>
> Hi all,
>
> My problem:
>
> I have three methods which returns a promise, via http request:
>
>
> - launch() { ...} which launch a job on a backend, and return a
> promise (job ID)
> - progress(jobID){ ....} which return the progress status of the job
> - result(jobID){ ..} which return the result value of the job execution
>
>
> The job can take several minutes to be accomplished, which is too long for
> a standard http request.
>
> I want to call firstly the launch() method, then the progress() method.
> If the job status is still 'in progress', i want to recall the progress()
> every 3 seconds until the job is finished.
>
> Does anyone know how to do that ?
>
> Kinds regards
>
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.