Angularjs: ocLazyLoad vs Requirejs

后端 未结 2 887
挽巷
挽巷 2021-02-05 06:10

I\'m working on a big angluar project and obviously we need a way to lazy load our scripts.

I\'ve worked with require.js before and it\'s quite good, but the problem is

2条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-02-05 06:19

    You can use RequireJS with ocLazyLoad but I don't recommend it, it's just possible because people asked me to do it and it was easy to integrate. You don't need RequireJS because ocLazyLoad includes its own loaders for js/css/templates files, and it can load any kind of files, not just angular modules.

    If you want to lazy load Angular modules you will need a lib to register them with Angular (or wait Angular 1.5 that will allow you to do it).

    Bottom line is: you can use RequireJS with ocLazyLoad, or just ocLazyLoad (recommended), but you can't use just RequireJS

提交回复
热议问题