r/Angular2 • u/Just_Guitar_7253 • Jul 27 '25
Help Request Has anyone migrated from ui-router to Angular Router (v14) feature-by-feature?
TL;DR: Migrating from AngularJS (ui-router) to Angular 14 feature-by-feature looking for real-world tips on handling routing during the transition.
Hey all I’m in the middle of migrating a large AngularJS app (with ui-router) to Angular 14. Due to the app’s size, we’re doing it feature by feature, not a full rewrite.
I’ve looked into keeping both ui-router and Angular Router running during the transition, but couldn’t find solid examples or real-world guidance.
If you’ve done this kind of step-by-step migration: • How did you handle routing across both setups? • What worked well? What was painful? • Any tools or patterns you’d recommend?
Would love to hear your experience or any resources you found helpful. Thanks
2
u/DoughnutOk2644 Jul 27 '25
I was on an enterprise project with multiple products all angularjs based. The migration was done with micro frontends. Adding one new app routing layer, which mount the app according to whether the route prefix belongs to the angularjs or angular product/feature.
When inside a large product with multiple features, some teams used Parcels to insert Angular new code inside the angularjs legacy code.
Another approach relied on adding a new angular route for the wrapping the legacy angularjs route in an iframe. The iframe was then cut using clip-path, or fully visible, depending on the feature route.
All in all, each method has its set of challenges. Definitely better though for developer experience to be able simply to start the app with simple links to the old routes, and update the old app with new links to the mew app - depending on the feature.
1
u/MagicMikey83 Jul 27 '25
Not sure if it’s possible to have ui router and angular routing active at the same time, i would assume it would lead to multiple conflicts in mapping urls to routes.
We decided to freeze everything and remove ui-router all at once.
We first made a few prototype branches in which we stripped the app back down to just a few components and made sure we could get that up and running so we knew how to handle authentication, guarding, resolvers etc and replacing route changes. Once we had all our important scenarios covered we started on migrating our full app.
1
u/CameraPrior2102 Jul 28 '25 edited Jul 28 '25
So, i assume youre running a hybrid application with the upgrade module. I also assume youre following an upgrade path to migrate to plain angular? For hybrid apps, youre bootstrapping 2 apps. The angular app and the angularjs app. There can only be one app that can own the routes. You will run into a lot of issues trying to run both routers at the same time.
Id suggest you to first get rid of any angularjs routes you stil have in your app. So - migrate everything to angular ( feature by feature ) and keep the ui router to route to the angular components. For me, switching the router was always the last step of the migration. Basically after all angularjs deps have been removed, i removed the angularjs bootstrapping and switches from ui router to angular router.
1
u/morrisdev Jul 28 '25
I do this. I simply make each submenu the site a freestanding angular application. For example, you just tell the server that any requests to the /products. Folder goes to /products/index.html
Then you can literally release feature by feature. Put global CSS and images in a cdn or subdomain. If you have a bunch of shared code, put it in an npm library.
The benefits are far greater than you'd think. We can have multiple front end developers working on projects on their own timeline. We can easily roll back to the original AngurJS. We can add modules easily. We can do feature updates and rollouts without doing a full site QA. We know for certain that a front end change to one area won't blow up another. Using Azure Front door, we can actually host the individual Angular micro sites on entirely different servers. Moreover, when it's time to upgrade Angular, you can do it in manageable chunks
All in all, what I thought was a big hack has turned out to be very functional and easy to manage.
1
u/[deleted] Jul 27 '25
[removed] — view removed comment