This is an example of hacking Angular v1.x to lazy load code that a bunch of people have asked me for.
Simply include lazyLoad.js
, use angular.lazyLoad
in route resolve
and it will magically work.
The main.js
is loaded at the beginning. Later, when navigating to /list
route, additional module lazy-list.js
is loaded. It should be fairly simple to make this work with RequireJS.
In Angular v2, integration with a module loader (such as RequireJS) and lazy loading will be simple.