urish / angular-load

Dynamically load scripts and css stylesheets in your Angular.JS app
MIT License
243 stars 65 forks source link

Would I be able to directly use it in app.config? #11

Closed jremya closed 9 years ago

jremya commented 9 years ago

We have a single module and we are in need of the the dynamic script to be loaded before the $stateProviders are invoked. We tried injecting as below,

.config(function( $stateProvider, $urlRouterProvider, $httpProvider, angularLoad ) {

But got an error mentioning angularLoad is not a valid Provider.

urish commented 9 years ago

Right, this is not possible with angularLoad, as angularLoad loads the script asynchronously. The best way to go about this is probably to load the script dynamically (using require.js or similar) and bootstrap AngularJS manually only after the script has been loaded.