Migrating ocLazyLoad to modern Angular
ocLazyLoad loaded AngularJS modules and files on demand, usually inside ui-router resolve blocks.
What replaces it
| Option | When to choose it |
|---|---|
| Router lazy loading | loadComponent and loadChildren split the bundle per route, with no extra library. |
| @defer blocks | Lazy-load part of a template when it becomes visible or on interaction. |
How to migrate it
- Map each lazy-loaded module to a route in the Angular Router.
- Use dynamic imports with loadComponent; the bundler creates the chunks.
- 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