Carlos Cifuentes
AngularJS library migration · lazy loading

Migrating ocLazyLoad to modern Angular

ocLazyLoad loaded AngularJS modules and files on demand, usually inside ui-router resolve blocks.

What replaces it

OptionWhen to choose it
Router lazy loadingloadComponent and loadChildren split the bundle per route, with no extra library.
@defer blocksLazy-load part of a template when it becomes visible or on interaction.

How to migrate it

  1. Map each lazy-loaded module to a route in the Angular Router.
  2. Use dynamic imports with loadComponent; the bundler creates the chunks.
  3. During the hybrid phase, lazy-load the whole legacy bundle so migrated screens do not pay for it.

Watch out. Lazy loading the AngularJS bundle is one of the main performance levers in a hybrid app: users on migrated screens never download the legacy code.

Other libraries

Planning a migration or a micro-frontend platform?

In a 20-minute call you describe your situation and I tell you how I'd approach it. If it isn't worth doing yet, I'll say so.

Message me on LinkedIn