angular-load
angular-load copied to clipboard
several scripts or css
Hi
is it possible to chain several loads of scripts or cas ?
- 1
@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.
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 )