Skip to content

Angular 2 Beta is Out

Updated: at 08:15 PM

Angular 2 reaches beta, packing a lot of changes from the preview

Angular 2 is truly a different framework from Angular 1. Although there is ngUpgrade and ngForward to help transition, the syntax and API are vastly different.

Angular 2 introduces a DOM parser that process html attributes before hitting the DOM. That means the new star, brackets and parentheses are easier to handle under the covers. And Angular 2 makes directives camelCase instead of kebab-case. You may also notice that directive attributes don’t show up on the DOM. All that is parsed out before rendering.

ng-if is now *ngIf and ng-repeat=“item in items” is now *ngFor=“#item of items”. ng-eventname directives are gone in favor of (eventname) syntax.

Property-based directives such as ng-class, ng-style, and ng-disabled are gone in favor of bracket-notated binding: [class.classname], [style.property], [disabled].

ng-model becomes [ngModel] for one-way binding and [(ngModel)] for two-way binding.

The digest cycle is gone, replaced by an immutabile object style checking.

Typescript (or the ES6 subset of Typescript) is recommended, but Angular 2 comes with a webpack-style server and live reloader for development.

Read the announcement on the blog: angularjs.blogspot.com or checkout the updated angular.io website.