Migrating to Angular 2: Introduction

Angular 2.0 is live! And it’s time to use it and start discovering the new features it brings us.

If you have a brand new project to implement and you feel like angular will fit in your requirements, go and take a look at the new specification of Angular 2.

Otherwise, if your project has already started and you are using angular 1.x, then you are in the right place to start chasing the migration to v2.

There are some new concepts you have to keep in mind from the start. You should be completely changing your approach.

Things you need to keep in mind

  • Everything is a Component (from the root element until a little part of your view).
  • Isolation is the key to keep your application maintainable and testable.
  • Forget about $scope.
  • Use Facade Pattern for dependencies (Never trust on them).
  • Use ES6 syntax.
  • You don’t need Factories, use simpler Services instead.
  • Controllers shouldn’t hold any business logic, we give this responsibility to our Services instead.

Your goal at the end of this series of articles will be to move to Angular 2 in the smoothest state of your code, so you don’t have to change much to do this update.

I hope you enjoy and get to know best practices for your next generation of angular application.

Let’s start!

In the first chapter we will be bootstrapping our application and see the possibilities angular provides us to do it.