Angular 1.x to 2+ Migration — Way to move ahead

Nitin Jain
Globant

--

Introduction

This blog covers the technique to migrate avoiding the hurdles and seamlessly achieve the rewrite from Angular 1.x version to Angular 2+ versions. This covers the initial thought process and steps to get started with the approach limiting the gaps and avoiding unknown discoveries.

Artifacts

Understanding and Knowledge of the application to be migrated is the prerequisite. Existing Libraries to be used or deferred. Exploring possibilities of the upgrade for the existing libraries or introducing new posts comparing those with equivalent ones.

The biggest decision and thought process lies in the architecture, having AngularJS component-based approach, Hybrid or Rewrite. This depends on the availability of the skill set and timelines.

The designing of base architectural structure of Components ,Routing, and exploring features which require research. Also, migration requires UX efforts which needs to be a major chunk of consideration.

Common Issues and Solutions

Functional Understanding of the application to be migrated is a must. i.e. Getting aware of the unknown areas which get discovered while regression testing.

Identification of external libraries and replacement. i.e. d3.js replaced by SVG approach.

Unknown areas which required R&D to be identified and resolved. i.e. the decision of replacing d3.js has been taken but impact analysis and understanding how the changes need to be done can be part of R&D.

Understanding the architecture of the existing application and designing the component based architecture of the part to be migrated. i.e. Referring to the atomic design approach to architect the application.

UI Code Coverage could help you to cover the scenarios more appropriately. i.e. Having covered major of the scenarios using Unit Testing code which helps the dependency code and test coverage.

Usage of the automation, to convert JavaScript code to typescript can expedite the process. Also using tools for finding a way to move ahead, which helps you understand the complexities of the existing application and with prerequisites.

Benefits of Migration

Component-based architecture helps code reusability as much as possible.

Differential Loading helps you to maintain cross-browser compatibility.

Multiple features introduced for lightning performance i.e. better Change detection, Event handlers handled quickly, frames per second, DOM Manipulation etc. Provides cleaned-up, maintenance-free code and architecture.

Flexibility and usage of TypeScript provide code optimization and reduces runtime errors.

Material Designs helps with the creation of responsive and multiplatform applications.

Closing Thoughts

Above steps helps you to get started and follow best practices while working and completion of Migration of application from AngularJS 1.x to Angular 2+ versions. Providing common issues and solutions to those with benefits.

--

--