angular-load icon indicating copy to clipboard operation
angular-load copied to clipboard

several scripts or css

Open vptcnt opened this issue 10 years ago • 3 comments

Hi

is it possible to chain several loads of scripts or cas ?

vptcnt avatar Jan 25 '15 13:01 vptcnt

  • 1

gang-qiu avatar Apr 29 '15 18:04 gang-qiu

@vptcnt / : @kevin-qiu: given that loadScript() and loadCSS() both returns a promise you could chain one promise to the other or even make a wrapping functioin that given a list of resources make this for you.

by the way @urish i agree that this would be an interesting feature; loadCSS and loadJS may accept also an array of resources and return a promise that will fire whenever all resources are fetched.

evilaliv3 avatar May 19 '15 20:05 evilaliv3

Promises make this very easy, So I'm not sure I'd duplicate this functionality in the library:

$q.all([
    angularLoad.loadScript('https://mysite.com/someplugin1.js'),     
    angularLoad.loadScript('https://mysite.com/someplugin2.js')
]).then( reactToAllScriptsBeingLoaded )

jsdw avatar Oct 02 '15 10:10 jsdw