Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is angular-loader.js for?

Tags:

angularjs

Angular loader allows your angular scripts to be loaded in any order.

As angular-seed project shows us, Angular loader does not have any specific api, you just put it at the top of your index file (so that it's executed first) and then proceed to load your application files anyway you prefer.

But, the most important thing for your use case is that you don't really need angular loader at all. RequireJS also allows your files to be loaded in any order, but it also provides you with many other features that angular loader just isn't made for.

So, yes, you may use it with RequireJS, but you don't need to, because it becomes redundant.


Angular modules solve the problem of removing global state from the application and provide a way of configuring the injector. As opposed to AMD or require.js modules, Angular modules don't try to solve the problem of script load ordering or lazy script fetching. These goals are orthogonal and both module systems can live side by side and fulfil their goals.

http://docs.angularjs.org/tutorial/step_07#anoteaboutdiinjectorandproviders


It allows for you asynchronously load files when bootstrapping your angular application. A good example is the angular-seed project that has an index-async.html file that does this.

index-async.html

This is useful for using other libraries that load in modules asynchronously.


See angular-async-loader: https://github.com/subchen/angular-async-loader/

To async load following components:

  • List item
  • controller
  • services
  • filter
  • directive
  • value
  • constant
  • provider
  • decorator