If you're like me and love Angular in all its ways, then brace yourselves. Remember how long it took you to understand directives, or having $scope finally click? Well, I don't want to be the bearer of bad news, but it was mostly all for naught. Angular 2.0 is a completely different framework.

This is just a primer to Angular 2.0. The final decisions are still up in the air, but I will make sure to update this post when new information arises.

[FYI: Angular 2.0 was announced at ng-conf in Europe this year and you can watch the video here. It is a painstakingly awkward video where both Igor and Tobias try to insert jokes to no avail.]


What's Different?

Let's see what the Angular team is deciding to remove:

  • controllers
  • directive definition objects
  • $scope
  • angular.module
  • jqLite

Templating Syntax

Not only that, the templating syntax is different. For example, the lines:

<input type="text" ng-model="user.todo">
        <button ng-click="addTodo()">Add Todo</button>
        

is turned to :

<input type="text" [value]="todo">
        <button (click)="addTodo()">
        

The handlebars data-binding is still the same though.

Dependency Injection

One of the strongest distinctions between Angular and other Javascript web frameworks is dependency injection (DI). By eliminating module configuration, ECMAScript's declarative syntax will be used instead. Since the new Angular is leaning more towards an object-oriented style framework, DI will look more like this (docs):

@Inject(TodoList, TodoFilter)
        export class AppView extends View {
            constructor(todos, filter) {
                this.todos = todos;
                this.filter = filter;
            }
            // ...
        }
        

[taken from here]


The Future For Angular

I previously mentioned Angular's new object oriented flavor - this is Miško Hevery's AtScript. AtScript is a superset of Microsoft's TypeScript, which discourages DOM wrappers inside Angular. It's annotative (@ Script) declaration allows for developers to 'express intents' for classes, similar to type checking in object oriented languages. Miško also mentions that this will improve performance drastically by compiling the raw DOM. AtScript compiles to ECMAScript 5+ - but he adamantly explains how AtScipt will be optional.

To top it all off, there will be no migration path from 1.X to 2.0.

I really don't know why these changes are being implemented, especially all at once. I believe this should be thrown at us in versions, 1.4, 1.5,..., 2.0. It is said to have Angular 2.0 to be released sometime late next year, but you can already get started by using the beta builds (check out the code here), in case you still want to use Angular...

The only thread of hope us pre-2.0 developers has is the aforementioned changes MIGHT be in the next release, the Angular team has not finalized anything just yet and claims that the community's ideas are still very important, despite the incessant Angular 2.0 beatdown.

It's sad to think the Angular I learned will soon be obsolete.

R.I.P. Angular.

Looks like I'm switching to Ember.