1.

How to enable lazy loading in Angularjs?

Answer»

With lazy LOADING, JS components can be LOADED asynchronously on activation on a specific route.

  • Download and INSTALL ocLazyLoad.js
  • Add the module in the application
  • Load the file in the required controller
  • Add to the router’s code as
Example

resolve: {
     loadMyCtrl: ['$ocLazyLoad', function($ocLazyLoad) {return $ocLazyLoad.load('routerState');
}]}



Discussion

No Comment Found