The problem
AngularJS served many teams well, but its end of life is here. Frameworks like Angular, React and Vue have moved on, and the tooling around AngularJS no longer gets security patches. You still have to ship features and fix bugs. A full rewrite sounds clean but usually stalls: the old app keeps changing, the new one falls behind, and nobody can switch it off. The result is two half working apps and a team that dreads Monday.
The core difficulty is that AngularJS code mixes concerns. Directives touch the DOM, controllers hold business logic, and services talk to the network. Two way binding hides data flow, so a small change can trigger updates in places you did not expect. Templates are HTML with custom tags, and scopes are implicit. That makes it hard to slice off a piece and run it next to the old app without breaking things.
You also have to keep the app running during the migration. Users do not care about your framework. They care that the invoice screen loads and the save button works. Any plan that requires a freeze or a big cutover date carries outage risk and political risk. The safer path is to modernize in place, one route at a time, with the old and new code sharing the same page where needed.
This playbook is about that path. It assumes you cannot stop the business to rewrite, and that you want each step to be reversible. We will look at what a good migration looks like, how to build it, what can go wrong, and how to tell you are making progress.
What a good solution looks like
A good modernization keeps the app live while you replace it piece by piece. You start by putting a router in front that can send some URLs to the old AngularJS app and some to the new one. That router can be a thin reverse proxy, a server side include, or a client side shell that mounts either app. The key is that each route is owned by exactly one app at a time, so you never have two sources of truth for the same screen.
Next, you make the old app easier to carve. That means removing hidden coupling: replace global state with explicit services, move business logic out of controllers into plain JavaScript modules, and replace custom directives with components that have clear inputs and outputs. You do not need to finish this everywhere. You only need it on the routes you plan to move first.
A good solution also shares code instead of copying it. Authentication, HTTP interceptors, formatting helpers, and feature flags should live in framework neutral modules that both apps import. That way a bug fix lands once. Build tooling should produce two bundles from one repository, or two repositories with a shared package, so a single pipeline can test and deploy both.
The end state is not necessarily zero AngularJS on day one. It is a codebase where every remaining AngularJS route is small, isolated, and on a list to be retired. You can stop at any point and still have a working app. That is the difference between a migration and a rewrite.
How to build it
Begin with an inventory. List every route, the components it uses, the services it calls, and the tests that cover it. Mark each route with traffic, business criticality, and how tangled its dependencies are. Pick two or three low risk routes to move first. A settings page or a read only report is ideal. Avoid the checkout flow until you have practiced the pattern.
Set up the shell. Add a top level router that decides which app renders a given URL. In many setups this is a small host page that loads either the AngularJS bundle or the new framework bundle based on a route table. Use a feature flag per route so you can switch back without a deploy. Make sure both apps can run on the same page during the transition, because some screens will embed a new widget inside an old page or the reverse.
For each route you move, write a thin adapter. The new component receives the same data the old controller had, often through a shared service or a custom element. If you use web components, you can mount a new framework component inside an AngularJS directive with little glue. The adapter should translate events and data, not business rules. Keep business rules in shared modules so both sides behave the same.
Then migrate the route. Build the new screen, wire it to the shared services, and run both versions side by side behind the flag. Compare outputs on real data. Once the new route matches, flip the flag for internal users, then for a small share of traffic, then for everyone. Keep the old route code until you are confident, then delete it in a separate change. Repeat. Each cycle should take less time than the last.
Risks and how to manage them
The biggest risk is scope creep. A route that looks simple can pull in a directive used in twelve other places. Before you commit, trace the dependency graph and write down what you will and will not touch. If a shared directive is too tangled, wrap it instead of rewriting it, and add it to a later phase. Timebox the investigation so one route cannot stall the whole effort.
A second risk is behavior drift. AngularJS two way binding can mask timing issues, and the new framework may render before data arrives. Write contract tests that run against both implementations with the same fixtures. Capture network responses and replay them. Check empty states, error states, and slow connections, not just the happy path. If a screen has offline or retry behavior, test that too.
Deployment risk comes from running two apps at once. Watch bundle size, because loading both frameworks on one page is heavy. Load the second framework only on routes that need it, or use module federation so shared code is fetched once. Keep an eye on memory leaks when mounting and unmounting components across frameworks. Test in the browsers your users actually use, including older ones if you still support them.
People risk is real. The team that knows AngularJS may resist a plan that makes their skills obsolete. Pair them with the people learning the new framework and let them own the adapter layer. Document decisions in the repository, not in chat. And keep a rollback plan for every flag: know the exact commit and setting to revert, and practice it once.
How to measure success
Track the share of routes served by the new app, not lines of code. Routes are what users see, and they are what you can switch off. A simple dashboard that lists each route with its owner and status gives everyone the same picture. Update it weekly. If the number stalls, you have found a dependency problem worth fixing.
Measure quality on the routes you move. Error rates, page load time, and the number of support tickets per route are good signals. Compare before and after with the same traffic. If a new route is slower, fix it before moving the next one. Also track test coverage on shared modules, because those modules now serve both apps and a bug there hits everyone.
Watch the cost of carrying two frameworks. Bundle size per route, build time, and the number of open pull requests that touch both apps are practical indicators. When the old app shrinks to a handful of routes, set a retirement date and stop adding features to it. That date is the real finish line.
If you need a structured starting point, the Legacy modernization sprint from Cloudverg is $8,500/month and runs for three weeks. It produces an inventory, a risk list, and a step by step migration sequence with rollback points, which you can use to plan the route by route work described here. Other options include hiring a contractor for a fixed assessment or running the inventory yourself with the checklist above. Pick the one that gets you to a first migrated route fastest.
Frequently asked questions
Can I migrate an AngularJS app without rewriting it all at once?
Yes. Use a top level router to send some routes to the old app and some to a new framework. Move one route at a time behind a feature flag, and keep shared services in framework neutral modules. The old app stays live until each route is retired.
What should I migrate first from AngularJS?
Start with low risk, low traffic routes such as settings pages or read only reports. They let you practice the adapter pattern and the deployment process without touching revenue critical flows. Move the complex screens after the pattern is proven.
How do I run AngularJS and a new framework on the same page?
Mount the new component as a custom element or use a small adapter directive that passes data in and events out. Keep business logic in shared modules so both sides behave the same. Load the second framework only on routes that need it to keep bundle size down.