AngularJS 2.0 Is Radically Different
Written by Alex Armstrong   
Wednesday, 05 November 2014

The AngularJS team has given a view of the future of the framework and many programmers are finding it unacceptable. An almost complete break with the past means that many are working on projects that use an about to be obsolete framework with no upgrade path.

angularbanner

 

Google's AngularJS is one of the most popular UI frameworks and hence in use in many projects. So the news that the next version is going to make radical non-backward compatible changes is not something that many will welcome - "Is this a joke?" is a typical comment.  

At the initial presentation it was even stated that there will be no migration path from Angular 1.X to 2.0, but due to the angry response from programmers fearing that their apps are about to be deprecated, the Angular team has issued a blog post that softens this and its entire position on the new version:

"Our goal with Angular 2 is to make the best possible set of tools for building web apps not constrained by maintaining backwards compatibility with existing APIs. Once we have an initial version of Angular 2, we'll start to work on a migration path for Angular 1 apps."

The first big shock is the adoption of the very latest JavaScript and browsers. Angular 2.0 is built using ES6, which of course doesn't actually exist at the moment and should be finalized before the end of the year. Angular 2.0 is being developed using the Traceur compiler, another Google project, which compiles ES6 to ES5. What this means is that until ES6 becomes widely available you can work with ES5 if you want to, but to future proof it is much better to plan to use ES6.

Even more radical is that Angular 2 will introduce AtScript an extension of the TypeScript optional typing. In this case you don't have to use it because it definitely has to be compiled to ES6/5.

The other big change is that the framework will only target the "evergreen" browsers, i.e. the ones that keep up with Web standards - Chrome, Firefox, Opera, Safari and IE - but only the latest versions. This would mean that old IE versions and the Android stock browser might not work. 

AngularJS 2 will also support and make use of web components - a technology that wasn't ready for use when Angular was first designed. 

If this wasn't enough to worry you, the basic structure of the framework is also changing. A unified component model will get rid of controller and templates and provide a simpler, but different, way of working. Syntax is changing to make things more consistent - parentheses to invoke functions, square brackets for attributes, to give just two examples.

To provide some details, the Angular team give an example of a 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>
    </tab-pane>

which should be compared to the version 2.0 template

<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>

You can see that the syntax changes are going to need more than a search and replace. 

The objective of the changes is to make Angular faster and more logical. For example, the use of jqLite has been dropped in favor of direct interaction with the DOM, which is now thought to be standard enough not to need performance sapping wrappers.  In addition the entire framework will be modular, making it possible to only load what you want to make use of. 

You can see the presentation at ng-europe 2014 that started all the fuss in the following video:

 

 

 

There seems to be a lot to learn to come to terms with the new Angular. Most of the changes seem like good ideas. If you were to start again then they way that you would do it would be closer to Angular 2 than the original framework - but this is what critics are complaining about. They say that this is a new framework that has simple stolen Angular's name!

There is also the well known effect of killing the current version prematurely by announcing a new version to early. AngularJS 2.0 isn't likely to see use until the end of next year - yet would you start a new AngularJS project until it is available? Even here at I Programmer the effect has been to cancel a set of Angular tutorials because what is the point if you have re-write and more important reorganize to take account of something so different. 

The key point is that no matter how much better AngularJS 2.0 may be, its impact is to leave AngularJS 1.3 dead in the water. 

angularicon

More Information

ng-europe, Angular 1.3, and beyond

Related Articles

AngularJS Superluminal Nudge Released 

AngularJS 1.2 Released

Code School Adds AngularJS Course

AngularJS (Book Review)

 

To be informed about new articles on I Programmer, install the I Programmer Toolbar, subscribe to the RSS feed, follow us on, Twitter, FacebookGoogle+ or Linkedin,  or sign up for our weekly newsletter.

 

Banner


Insights Into Learning Computer Science
18/12/2024

JetBrains Academy has published the results of a worldwide survey that set out to discover current trends in computer science education and the challenges involved in studying computer science. I [ ... ]



Meta Releases OpenSource Podcast Generating Tool
28/11/2024

Meta has released an open source project that can be used to automatically convert a PDF file into a podcast. Meta says Notebook Llama can be considered an open-source version of Google's NotebookLM.

 [ ... ]


More News

 

espbook

 

Comments




or email your comment to: comments@i-programmer.info

Last Updated ( Wednesday, 05 November 2014 )