Can I use the Async.js library in AngularJS?

I need to repeatedly call api: /1/dir/{imgID} (50 times on average) using the change in imgID .

In node.js, I can use the Async.js library. Can this library be used on the Angular side? If so, give me some idea of ​​how this is possible, and if not, give me an alternative idea so that I can use this in AngularJS?

+6
source share
1 answer

Yes, you can.

Basically, you need to use $q.all(promises); , which can combine multiple promises into one promise, which is resolved when all promises are allowed.

Example: http://www.bennadel.com/blog/2772-exploring-asynchronous-promise-based-workflows-in-angularjs.htm

Document: https://docs.angularjs.org/api/ng/service/ $ q

Demo: http://bennadel.imtqy.com/JavaScript-Demos/demos/error-workflow-promises-angularjs/

+1
source

Source: https://habr.com/ru/post/973310/


All Articles