Considering freelancing? Check out the contract positions from Toughbyte.

Refactoring AngularJS Apps to Components

The Angular community has been moving towards component-driven UIs for some time now: Angular 2 will be all about components, and with Angular 1.x we are increasingly favouring patterns that approximate components.

The thing is, there is a whole lot of Angular code out there that doesn't use this pattern. Code littered with scope inheritance, ngControllers, ngIncludes, and ad hoc shared state. This is the kind of code that will be most difficult to bring into Angular 2, as it is architecturally very different from idiomatic ng2. It is also the kind of code that causes many headaches to many of us every day.

I've been searching for patterns of refactoring that can be applied to transform this kind of "old school" Angular 2 code towards component style in a systematic way. In this talk I'll share some of the patterns I've found.