What is angular-loader.js for?

后端 未结 4 1700
终归单人心
终归单人心 2021-01-31 07:19

I saw a similar question on the Google groups and also here on Stackoverflow. Both times the question was not answered. The code in this file doesn\'t make it very clear about w

相关标签:
4条回答
  • 2021-01-31 07:43

    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.

    0 讨论(0)
  • 2021-01-31 07:48

    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

    0 讨论(0)
  • 2021-01-31 07:53

    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.

    0 讨论(0)
  • 2021-01-31 08:02

    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
    0 讨论(0)
提交回复
热议问题