AngularJS 2.0 Details Emerge
Last week at the ng-europe conference in Paris, the Angular team gave attendees details about the upcoming AngularJS 2.0 release. It’s a significant departure from version 1.X with no migration path and made with a new language, AtScript, in mind.
Developers familiar with the Angular 1.X will encounter a drastically different looking framework and will need to learn a new architecture. In a session devoted to the changes in version 2.0, Igor Minar and Tobias Bosch introduced the new template syntax:
<input type="text" [value]="firstName"> <button (click)="addPerson()">Add</button>
This new syntax binds data to element properties, not attributes. This allows the syntax:
<input type="checkbox" [checked]="someProperty">
This looks like standard HTML, but the checkbox input element doesn’t expose a
checked attribute. The new template engine binds to element properties even if they’e not attributes exposed by the DOM.
This new template syntax is a relatively small change compared to the upheaval caused by the new architecture. Attendee Michael Bromley described some of these breaking changes. Version 2.0 eliminates the following 1.X concepts:
- Directive Definition Object
Referring to the eliminiation of jqLite, Igor said:
In 2.0 we are not going to use DOM wrappers inside of the framework at all. We’re just going to deal with the raw DOM. 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. So we can just build with raw DOM, but if you want to use jQuery, if you find jQuery useful in your components, that’s totally fine.
One of the goals for 2.0 is to improve the development experience for Angular apps. In his Day 2 Keynote, Miško Hevery, the father of AngularJS, described how the creation of AtScript, would accomplish this goal.
An annotation allows a developer to “express the intent” of a particular class. So, rather than writing boilerplate code to create a custom directive, developers can just create a class and tell AngularJS, “This is a directive”. The introspection capabilities enable the framework to look at the type information at runtime.
In a Q & A session, developers asked how long Angular 1.3 would be supported. Brad Green replied:
A reasonable expectation would be that after we release 2.0 final that something like 1.5 – 2 years beyond that we would support 1.3 for things like bug fixes and security patches.
The team also indicated that there is no migration path from Angular 1.X to 2.0, though they left the door open for this possibility. There is no release date set, but the consensus is that version 2.0 will be finalized late 2015.
Brad Green also mentioned that Angular 2.0 will only support “evergreen browsers”, but didn’t specify. He mentioned that the team was “trying to run to where the ball is going to be rather than where it is today”
Developers had mixed feelings about the massive change. On Hacker News, user zak_mc_kracken said:
Even though this is still called “Angular”, this new version has barely any resemblance with the previous one, it’s really a totally new framework. It’s a bit sad to think that all this knowledge I have of Angular 1 is now obsolete but I’m excited to dive into this new framework. If it’s half [as] revolutionary as Angular 1 was, it’s going to be a pretty interesting time.
Videos from the ng-europe conference were available on YouTube, but were soon removed. According to the ng-europe Twitter account they “will post all videos during the next two weeks”. Until then, developers can review the Angular 2.0 Design Docs and check out the GitHub repository.
Credit: Source link