javascript - lazy loading and $ocLazyLoad -


i discovered $oclazyload third party angular module enables lazy loading of javascript files. i'm bit confused concept. how lazy loading different caching, , why want lazy load when using angularjs?

caching , lazy loading 2 different concepts.

caching

caching file means not require go server grab again. instead pull browser's cache, saving http request time.

you can cache templates inlining them in html, save loading them file, increase initial loading time bytes size of templates. in general cache templates. , scripts aswell.

lazy-loading

lazyloading means file not loaded (no http request made) after module needed, loaded, script evaluated , executed.

you can lazyload , cache file ofcourse. caching using service workers, or relying on request headers , browser caching.


Comments