Migrating AngularJS to Angular 4,5 (with DEMO) [closed]
Asked Answered
R

1

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?

Robbierobbin answered 1/6, 2017 at 16:29 Comment(1)
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. chadfowler.com/2007/01/02/the-big-bang.htmlComedic
J
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

Joris answered 1/6, 2017 at 16:32 Comment(4)
in the plunker demo angular application is not running properly. Can i know the reasonAiry
@Joris 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 replyRibbentrop
@Joris 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?Ribbentrop
@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. Also AngularJS 1.5+ Components do not support Watchers, what is the work around?.Joris

© 2022 - 2024 — McMap. All rights reserved.