-3

I had to upgrade my AngularJS (v1) app to latest Angular 7. The application has already been rewritten in angular2. I know migration from angularjs to angular2 is completely different. But now looking for the easiest way to migrate from v2 to v7 . Can you please guide me how do I need to proceed further and what are all the things need to be taken care? I've gone through the following article as well, but still wants specific guidance: https://angular.io/guide/upgrade

Shall I proceed likewise as mentioned in this post or some other major steps as well- migrating from Angular 6 to Angular 7

Thanks in advance.

georgeawg
  • 48,608
  • 13
  • 72
  • 95
Chang
  • 435
  • 1
  • 8
  • 17

3 Answers3

2

You have few options

  1. ngMigration Assistant

  2. ngUpgrade

  3. Ifram

I recommend to:

  1. Create basic angular component ( it can be just Hello world component)
  2. Check you can add the basic component to your application. ( you can see Hello world on your screen)
  3. Check all your application working as expected. (angular 2+ not break your application)
  4. Check you can build your application currently.
  5. Continue moving directives/ filter ... one by one.

    • you can add some automation test that check your application before upgrading to angular. and after upgrading to angular the automation tests should be pass.
Chang
  • 435
  • 1
  • 8
  • 17
Yoav Schniederman
  • 5,253
  • 3
  • 28
  • 32
0

Incrementally upgrade an AngularJS application to Angular. One of the keys to a successful upgrade is to do it incrementally, by running the two frameworks side by side in the same application, and porting AngularJS components to Angular one by one. This makes it possible to upgrade even large and complex applications without disrupting other business, because the work can be done collaboratively and spread over a period of time. The upgrade module in Angular has been designed to make incremental upgrading seamless. for more details you can follow that link https://medium.com/contentsquare-engineering-blog/angularjs-to-angular5-upgrading-a-large-application-7e6fbf70bafa

Bheem Singh
  • 607
  • 7
  • 13
0

Everything about Angular differs drastically from AngularJS, so much so that I would consider them entirely different frameworks.

You'll be able to make use of much of your template code, and you'll likely be able to reuse any custom business logic and functions, but you are going to want to consider your AngularJS application a functional prototype, and redesign your Angular7 application based on what you've learned from the AngularJS one.

You're going to be switching from Javascript to Typescript, the component architecture is very different from how you would have built the JS application. Angular does away with two-way binding in almost all cases in favor of a uni-directional dataflow.

Any 3rd party libraries you may have used are likely going to need to be replaced or updated to the latest Angular compatible (rewritten) versions.

Having gone through both ground up AngularJS development, ground up Angular development (from 2 through 7), and a rewrite of an AngularJS application in Angular 7, I would strongly suggest learning as much as you can about building new applications in Angular 7, and then redeveloping your JS application from scratch with your new found knowledge, rather than try to drag an old codebase into the new framework.

Stephen R. Smith
  • 3,310
  • 1
  • 25
  • 41