17

I am looking into ways of migration a current Angular 1 project to Angular 4.

Options are ng-forward, ngUpgrade or rewrite.

I am thinking on rewriting it but with a twist.

  • I keep the current application
  • Start writing the new one parallel to it
  • All new NG4 rewrites, I want to use ... so bit by bit in other words.

Has anyone attempted this or know a better way?

georgeawg
  • 48,608
  • 13
  • 72
  • 95
  • 2
    This question will be closed almost immediately as "primarily opinion based", but: your plan is called the "big bang rewrite", it's very common, and it's a bad idea. http://chadfowler.com/2007/01/02/the-big-bang.html – Daniel Beck Jun 01 '17 at 16:31

1 Answers1

25

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 information, see Angular Developer Guide - Upgrading from AngularJS

The DEMO on PLNKR

Community
  • 1
  • 1
georgeawg
  • 48,608
  • 13
  • 72
  • 95
  • in the plunker demo angular application is not running properly. Can i know the reason – dinu Apr 08 '20 at 08:52
  • @georgeawg I have a huge code base with angularjs1.4.x with directives. Then first we need to convert all directives to components(1.4 to 1.5 migration) then Angular. Please reply – Ankit Pandey Dec 12 '20 at 16:36
  • @georgeawg I upvoted. Actually, my main question is -> I have a product(with a huge codebase) in angularjs1.4.x(that contains directives only...... not angularjs components) and I want to upgrade using ngUpgarde to Angular latest version. Can I do the upgrade where code having directives not angularjs components? – Ankit Pandey Dec 12 '20 at 17:21
  • @AnkitPandey AngularJS components were specifically created to facilitate the migration to Angular 2+. Your directives likely need to be rewritten to be compatible with the Angular 2+ structure. For more information, see [AngularJS Developer Guide - Component-based Application Architecture](https://docs.angularjs.org/guide/component#component-based-application-architecture). Also [AngularJS 1.5+ Components do not support Watchers, what is the work around?](https://stackoverflow.com/a/35535336/5535245). – georgeawg Dec 13 '20 at 09:34