Open msnpr567 opened 9 years ago
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){
....
});
If they're all-at-once instead of in-a-row then just use $q.all()
@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.
@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.
I want to use angular-busy loader for a time of 5 successive requests , can i use it ?? then how?? (or) can i include multiple promises at a time?