AngularJS 2.0 aims to improve performance, support modern web standards like ES6, and have an easier programming model compared to AngularJS 1.x. Key changes include dropping controllers and scopes in favor of components as the fundamental building block. Templates will use property and event binding rather than directives. AtScript is a new syntax that adds types, annotations and introspection to ES6 for better development experience.
29. Event binding
<button (click)="doSomething()">click me</button>
<div (^click)="doSomithing">
<img src="..."><span>text</span>
</div>
<zippy #zippy title="Greeting">
Body of the text which is shown conditionally.
<a href (hover)="zippy.close()">hover to close</a>.
</zippy>
<button (click)="zippy.toggle()">toggle</button>
52. Using services
import {TodoStore} from './store';
@ComponentDirective({
directives: [TabContainer, TabPane, NgRepeat]
})
class SantaTodoApp {
constructor(store:TodoStore) {
...
}
...
}
53. Directives and DI
<tab-container>
<tab-pane title="Tobias">
New Macbook Pro
Tesla Model X
...
</tab-pane>
<tab-pane title="Good kids">
...
</tab-pane>
<tab-pane title="Bad kids">
...
</tab-pane>
</tab-container>
54. Directives and DI
class TabPane {
constructor(
tabContainer:TabContainer,
element:HTMLElement
) { ... }
...
}
class TabContainer {
constructor(tabs:Query<TabPane>) { ... }
...
}
55. 요약
사망 : Controller, $scope, DDO, Module, jqLite
출생 : AtScript, Web Component 지원, more?
다이어트를 했다?
57. reference
Angular 2.0 Core by Igor Minar & Tobias Bosch at ng-europe 2014(Youtube)
Miško Hevery - Keynote on AtScript at ng-europe 2014 (Youtube)
Angular v2 Template Syntax Summary (Google Doc)
Databinding with Web Components (Google Doc)