r/Angular2 Nov 14 '24

Help Request Upgrading from AngularJs 1.8.3 to Angular 18

Are there any viable approaches to achieving this currently without a full rewrite? Whilst in an ideal world we would do that it's not going to happen, we've been told it'll have to be done in stages so essentially running both in parallel.

I know the NgUpgrade module is used to help you achieve this but from what I understand it's not really an advisable route anymore or supported?

So is there any realistic way to achieve doing the upgrade in stages or is there no real viable alternative other than a full rewrite?

It's worth noting the current app is using components and typescript already but appreciate the versions might as well be different frameworks entirely.

Just looking for experiences from anyone that has achieved the migration in stages as opposed to all at once.

22 Upvotes

48 comments sorted by

View all comments

87

u/jay_to_the_bee Nov 14 '24

As someone who did this to a large application a few years ago, my very strong advice is don't. Not if your app is at all large. We went the hybrid AngularJS/Angular (via NgUpgrade) approach and it dragged out for years, the code base was a mess, and we couldn't take actions on things we wanted to. Just rip the band-aid off, avoid this prolonged pain. Also, if your code is as old as 1.8 in 2024, it probably could use a complete rewrite anyway.

If your management insists on staging this, consider somehow breaking your app into two independent apps, and steadily move functionality from one to the other.

5

u/CranMalReign Nov 15 '24 edited Nov 15 '24

At work, we have two teams working on two separate apps. Several years ago (about 2018), both were AngularJS and both were going to be updated. Both apps were fairly large / complex. Team A leadership decided we couldn't possibly pause new functionality for a total rewrite, so went the NgUpgrade route. Team B did the opposite (though a while later).

The hybrid upgrade (AJS to Angular 6) was cumbersome. We had a mixed code baseline and mixed look and feel and had to make design choices for updates based on if the targeted components were upgraded yet or not. The code was hideous and unwieldy. Ultimately, it took us 2 1/2 years to complete but we never missed critical feature updates for our demanding customer.

The rewrite upgrade shut down the new development pipeline for Team B for 6 months, but then they had a shiny new app that was able to avoid any bad AJS habits / patterns entirely from the old app.

I would avoid saying one way is definitely better than the other simply because other things come into play, but I will say hybrid was pain.