How to upgrade from angular 1.4 to angular 5?

1.8k Views Asked by At

enter image description hereTo upgrade from angular 1.4 to Angular 5 is it possible to use ngupgrade and follow incremental approach or it is strictly applicable to use ngupgrade from version 1.5. According to the image the prerequisites mentioned 1.5 is used for ngUpgrade.

3

There are 3 best solutions below

2
On BEST ANSWER

There is official upgrade guide: https://angular.io/guide/upgrade or https://angular.io/guide/upgrade-performance

But as a person who have written a big AngularJS application and now is working on a big Angular project, I recommend to start a new fresh project and step-by-step write a complete new application in the newest Angular. By my experience, switching between both frameworks is really hard and time-consuming.

In Angular things work totally different (better) and the framework itself offers much more than AngularJS.

If you still want to go the upgrade way, do it in 2 steps:

  • Upgrade to 1.5 (because there must be a reason why it is required)
  • Upgrade to Angular
0
On

Certainly look at https://angular.io/guide/upgrade to start. It's been a while since I've looked at it and it appears to have significant updates, which is nice. The "Preparation" section still reminds me of the joke: "How to be a millionaire and not pay taxes? Step 1: Get a million dollars." One section of preparation is "Using a Module Loader" which tells you why, but you're still on your own to figure out how to go from, say, grunt to webpack. It's beyond the scope of that page, sure, but that feels like big amorphous step to sort out.

I did find a developer, Sam Julien, that put together a guided video "course" which takes an app and walks through converting it. It is at https://www.upgradingangularjs.com and is certainly more comprehensive than any blog post I've seen. I'm not affiliated but it has gotten me started on laying out some of what we need to change.

It's not a trivial undertaking but being able to see the stages laid out ahead of time has made it seem incrementally possible. (Luckily, we are pretty close to the angularjs style guide already, which is another preparation step.) Good luck!

0
On

Take a look at this article: https://angular.io/guide/upgrade

And you can upgrade or downgrade services and components between two frameworks.

You should know that there are two ways to bootstrap a Hybrid App:

  1. Using UpgradeModule - Bootstraps both the AngularJS (v1) and Angular (v6) frameworks in the Angular zone

  2. Using DowngradeModule - Bootstraps AngularJS outside of the Angular zone and keeps the two change detection systems separate.

I have tried both ways. And I recommend using DowngradeModule - it's better for performance and memory leaks.

If you google angular hybrid you will find a lot of articles and examples on github