GithubHelp home page GithubHelp logo

Comments (4)

cgross avatar cgross commented on May 20, 2024

If you are using a regular promise chain then just assign the promise from the last then() to cg-busy like:

$scope.myBusyPromise = $http(...).then(function(data){
    ...
}).then(function(data){
   ...
}).then(function(data){
   ...
}).then(function(data){
   ....
});

from angular-busy.

cgross avatar cgross commented on May 20, 2024

If they're all-at-once instead of in-a-row then just use $q.all()

from angular-busy.

naysayer avatar naysayer commented on May 20, 2024

@cgross could you give an example of how to use $q.all()? I am in a situation where I have a dynamic number of calls being made and would like the loading icon to be displayed until they are all complete. Thanks in advance.

from angular-busy.

fabiosussetto avatar fabiosussetto commented on May 20, 2024

@naysayer example:

// controller
$scope.allDonePromise = $q.all([promise1, promise2, ...]);

// template
<div cg-busy="allDonePromise">

The spinner will be shown until all the promises will be resolved. Note the promises cab be run in parallel.
From Angular docs:
"$q.all(): Combines multiple promises into a single promise that is resolved when all of the input promises are resolved."
CgBusy is very cool because he doesn't care about http requests, all it cares about are promises.

from angular-busy.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.