2.0
<div ng-controller="UnicornController">
<input type="text" ng-model="unicornName">
<button ng-click="addName()">Add</button>
<tab-container>
<tab-pane title="{{ unicornsList.length }} Unicorn names">
<div ng-repeat="unicorn in unicornsList">
<input type="checkbox" ng-model="unicorn.valid">
{{ unicorn.name }}
</div>
</tab-pane>
</tab-container>
</div>
<div>
<input type="text" [value]="unicornName">
<button (click)="addName()">Add</button>
<tab-container>
<tab-pane title="{{ unicornsList.length }} unicorn names">
<div [ng-repeat|todo]="unicornsList">
<input type="checkbox" [checked]="unicorn.valid">
{{ unicorn.name }}
</div>
</tab-pane>
</tab-container>
</div>
Attention: la syntaxe va probablement changer
Voir: https://github.com/angular/angular/issues/133
<div>
<input type="text" [value]="unicornName">
<button (click)="addName()">Add</button>
<tab-container>
<tab-pane title="{{ unicornsList.length }} unicorn names">
<div [ng-repeat|todo]="unicornsList">
<input type="checkbox" [checked]="unicorn.valid">
{{ unicorn.name }}
</div>
</tab-pane>
</tab-container>
</div>
Attention: la syntaxe va probablement changer
Voir: https://github.com/angular/angular/issues/133
<div>
<input type="text" [value]="unicornName">
<button (click)="addName()">Add</button>
<tab-container>
<tab-pane title="{{ unicornsList.length }} unicorn names">
<div [ng-repeat|todo]="unicornsList">
<input type="checkbox" [checked]="unicorn.valid">
{{ unicorn.name }}
</div>
</tab-pane>
</tab-container>
</div>
Attention: la syntaxe va probablement changer
Voir: https://github.com/angular/angular/issues/133
<div>
<input type="text" [value]="unicornName">
<button (click)="addName()">Add</button>
<tab-container>
<tab-pane title="{{ unicornsList.length }} unicorn names">
<div [ng-repeat|todo]="unicornsList">
<input type="checkbox" [checked]="unicorn.valid">
{{ unicorn.name }}
</div>
</tab-pane>
</tab-container>
</div>
Et interpolation de propriétés
Attention: la syntaxe va probablement changer
Voir: https://github.com/angular/angular/issues/133
2009 - 2014
angular.module('docsTabsExample', [])
.directive('myTabs', function() {
return {
restrict: 'E',
transclude: true,
scope: {},
controller: function($scope) {
// ...
},
templateUrl: 'my-tabs.html',
compile: function compile(tElement, tAttr) {
// Compile code goes here.
return {
pre: function preLink(scope, element, attr, ctrl) {
// Pre-link code goes here
},
post: function postLink(scope, element, attr, ctrl) {
// Post-link code goes here
}
};
}
};
}
);
Brian Ford
Igor Minar
2009 - 2014
Les directives sont des classes
exportées en modules
et transformées en web components
@ComponentDirective({selector: 'body'})
class UnicornParkApp {
constructor() {
this.unicornName = '';
}
addName: function() { ... }
unicornsList: []
}
→ directives avec transclusion (ng-if, ng-repeat, ng-include)
→ composants complexes
→ ajoute un comportement à un élément (ng-show, ng-class)
2009 - 2014
import {LocalStorage} from 'ngData';
@ComponentDirective
class UnicornParkApp {
constructor($localStorage:LocalStorage) {
this.unicornName = '';
this.$localStorage = $localStorage;
}
addName: function() {
this.$localStorage.setItem(this.unicornName);
}
unicornsList: []
}
class TabPane {
constructor(tabContainer:TabContainer) { ... }
...
}
class TabContainer {
constructor(tabs:Query<TabPane>) { ... }
...
}
2009 - 2014
→ demo
→ macro optimisations
→ navigateurs modernes
→ meilleur dirty checking: Watchtower / Design doc
→ plus besoin de wrappers dom & de couche de compatibilité
2009 - 2014
We are NOT building a new language*
*Okay, maybe just a little.
class MyClass {
methodA(name:string):int {
var length:int = name.length;
return length;
}
}
class MyClass {
methodA(name) {
var length = name.length;
return length;
}
}
AtScript
ES6
class MyClass {
constructor(name:string, list:Array) {}
}
import * as rtts from 'rtts';
class MyClass {
constructor(name, list) { }
}
MyClass.parameters = [
{is: rtts.string},
{is: Array}
];
AtScript
ES6
→ analyse au runtime
→ vérification du type structural
function(myVar:Array<CssSelector>) { ... }
→ mise en cache de vue possible
→ chaque module peut définir ses routes
→ valider un changement de state
→ injection d'étapes en cours de routing
→ service de haut niveau
→ permet l'encryption des données
→ mise en cache
→ buffers et auto pagination
→ méthodes de lecture/écriture surchargeables
→ auto-synchronisation avec le stockage
→ auto-synchronisation avec le serveur
→ logs d'erreur, de tests, de debug, ...
→ aussi fluide & utilisable sur mobile que sur desktop