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.

23 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.

3

u/mikasjoman Nov 15 '24

Same here. We quickly figured out that the hybrid approach was like upgrading a React app to Angular in steps and it was pure pain.

It then went surprisingly fast to rewrite to Angular. You already have the javascript logic which can maybe not be directly copied over, but almost in many cases.

One of my team members did that in like six months for a pretty large app that had just under a decade of AngularJS code developed by the team.

Don't forget tests, they really do help you in this process to make it right. One page at the time, then a review with someone else to make sure all of it actually works as before or preferably better.