Just a few thoughts I wanted to throw out there. Feel free to provide feedback. I’ll probably add to this over the next few months.
Angular 2 (now known as just Angular) is a complete rewrite of Angular 1 (now known as AngularJS). Here’s a few pros and cons around upgrading to the latest version of Angular (4.x):
Pros:
- Typescript – Angular was created to work, first and foremost, with Typescript. Typescript speeds up the development process by allowing editors to provide better tooling; autocompletion, code navigation, etc. Simple code errors are caught early on, in the editor, before running the app. Developers can also take advantage of decorators (annotations), arrow functions, destructuring, async/await and a myriad of other ES Next/Typescript features.
- ES Modules – you can import other libraries in a way a similar to node. ES modules provides ways to optimize your code, such as tree shaking, which allows you to remove code that your app ultimately doesn’t use and thereby decrease the size of the app’s javascript bundle.
- Forms – the latest version of Angular introduces model driven forms, as opposed to AngularJS‘ template driven forms. This allows forms to be easier to unit test which leads to more stable forms.
- Components – Angular’s focus is on composing components. Advantages include more modularized code, creating well defined and contractual api’s around directives/components and how they interact with each other. This, along with the other items mentioned above enforces better application architecture and design.
- Performance – change detection is completely different, no longer relying on a digest cycle. Instead zones are used to determine when asynchronous actions have been completed. The concept of unidirectional data flow allows components to interact with one another without causing side effects.
- Official Support and Security – Official support for AngularJS will eventually end (see AngularJS 1.x Support Lifecycle). Upgrading to the latest Angular appears to be the only sustainable path to continue to receive support and security updates for Angular in the future. The Angular team has provided tools to support running AngularJS and Angular simultaneously to encourage upgrading parts of your current AngularJS app a little at a time until it is completely up to date.
Cons:
- The initial learning curve for the team. Although, developers will most likely be able to pick up the concepts rather quickly, there are a number of concepts that are different coming from AngularJS and Angular; Typescript, component architecture, observables and RXJS, to name a few.
- Refactoring code always carries an element of risk. Hopefully most issues can be mitigated with proper unit tests and code coverage, but inevitably, things could (and probably will) break while migrating to the latest version of Angular.