search
A new angle

A sneak peek at the radically new Angular 2.0

Coman Hamilton
image
Angular structures via Shutterstock

Details have emerged about the next major release of Angular – which is making some major changes.

The face of AngularJS 2.0 is about to change. Or at least that’s what we can judge from the first samples of code revealed by the Angular team at the ng-europe conference in Paris.

So what does the next generation of Angular have in store for us?

“Drastically different”

Developers that are used to the incumbent look and feel of Angular are in for a few surprises. As InfoQ’s David Iffland comments, the framework will be “drastically different looking”, meaning users will need to get to grips with a new kind of architecture. It’s also been confirmed that there will be no migration path from Angular 1.X to 2.0.

According to AngularJS founder Miško Hevery, the goal of Angular 2.0 is to completely overhaul the development experience. One means of doing this is Google’s new programming language AtScript, which can be employed for developing Angular applications.

SEE ALSO: Community shitstorm – Angular 2.0 announcement backfires

A superset of JavaScript, AtScript expands on several of Microsoft’s ideas for TypeScript. While TypeScript adds types to pure JavaScript, AtScript brings annotations and introspections. AtScript compiles in EcmaScript 5-compatible JavaScript code, which works seamlessly with other JavaScript components.

Goodbye familiarity

Users will soon also be forced to bid farewell to the familiar concepts of controllers, directive definition objects, $scope, angular.module and the built-in Angular 1.x jQuery Subset jqLite. What is more, DOM Wrapper will be completely dropped from the project, as Angular developer Igor Minar made clear. “We’re just going to deal with the raw DOM,” Minar explained. “The DOM has improved quite a bit since we started, so we don’t actually need a compatibility layer that will help us with the different browsers as much as we used to need it.”

In the Angular 2.0 demonstration (below), the Angular team compared this example of an Angular 1.3 template:

<div ng-controller="SantaTodoController">
    <input type="text" ng-model="newTodoTitle">
    <button ng-click="addTodo()">+</button>

   <tab-container>
    <tab-pane title="Tobias">
        <div ng-repeat="todo in todosOf('tobias')">
            <input type="checkbox">
            ng-model="todo.done"
            {{todo.title}}
            <button ng-click="deleteTodo(todo)">
            X
            </button>
        </div>

…to a distinctly different way of doing the same thing in Angular 2.0:

<div>
    <input type="text" [value]="newTodoTitle">
    <button (click)="addTodo()">+</button>
   <tab-container>
    <tab-pane title="Good kids">
        <div [ng-repeat|todo]="todosOf('good')">
            <input type="checkbox" [checked]="todo.done">
            {{todo.title}}
            <button (click)="deleteTodo(todo)">
            X
            </button>
        </div>
    </tab-pane>
</tab-container>
</div>

A closer look reveals that ng-model and ng-click have disappeared, while square brackets are now being used for attributes. Just like in JavaScript, Angular 2.0 will also use parentheses to invoke methods.

We can expect to hear more details about the new AngularJS design in the coming weeks. If you don’t feel like waiting, you can already check out the Angular 2.0 Design Docs and the GitHub repository.

Angular 2.0 release

In spite of early excitement about the next major release, it will be some time before we’ll be able to get our hands on the final version. Initially planned for release by the end of 2015, early to mid 2016 seems more realistic given the drastic changes that are planned. UPDATE: The Angular team has announced it is “really close” to Angular 2.0, and that Angular 1.x will be supported until “the vast majority” of users switch to Angular 2.o.

SEE ALSO: Google announces new, softer approach to Angular 2.0 and retires AtScript

According to Brad Green of Angular, Angular 1.3 will continue to receive bugfix and security patch support for 18-24 months after the release of version 2.0.

Author
Coman Hamilton
Coman was Editor of JAXenter.com at S&S Media Group. He has a master's degree in cultural studies and has written and edited content for numerous news, tech and culture websites and magazines, as well as several ad agencies.
Comments
comments powered by Disqus