diff --git a/public/docs/_examples/template-syntax/ts/package.json b/public/docs/_examples/template-syntax/ts/package.json index 245a10d30a..b2b21e7953 100644 --- a/public/docs/_examples/template-syntax/ts/package.json +++ b/public/docs/_examples/template-syntax/ts/package.json @@ -11,7 +11,7 @@ "author": "", "license": "ISC", "dependencies": { - "angular2": "2.0.0-alpha.44", + "angular2": "2.0.0-alpha.46", "systemjs": "0.19.2" }, "devDependencies": { diff --git a/public/docs/_examples/template-syntax/ts/src/app/app.html b/public/docs/_examples/template-syntax/ts/src/app/app.html index 3af210b88a..37bab89d5d 100644 --- a/public/docs/_examples/template-syntax/ts/src/app/app.html +++ b/public/docs/_examples/template-syntax/ts/src/app/app.html @@ -374,3 +374,10 @@ See console log + + +
The name of the Color.Red enum is {{Color[Color.Red]}}
+The current color number is {{color}}
+
diff --git a/public/docs/_examples/template-syntax/ts/src/app/app.ts b/public/docs/_examples/template-syntax/ts/src/app/app.ts
index fd4e4d238e..54418707fb 100644
--- a/public/docs/_examples/template-syntax/ts/src/app/app.ts
+++ b/public/docs/_examples/template-syntax/ts/src/app/app.ts
@@ -12,7 +12,7 @@ import {bootstrap, Component, CORE_DIRECTIVES,
Input, Output,
Directive,
ElementRef, EventEmitter,
- FORM_DIRECTIVES
+ NgForm, FORM_DIRECTIVES
} from 'angular2/angular2';
class Hero {
@@ -78,7 +78,7 @@ class HeroDetailComponent {
hero: Hero;
@Output()
- deleted = new EventEmitter();
+ deleted = new EventEmitterLittle Tour of Heroes
-
-
+
+
`,
directives: [CORE_DIRECTIVES]
@@ -166,16 +168,18 @@ class KeyUpComponentV3 {
class LittleTour {
heroes=['Windstorm', 'Bombasto', 'Magneta', 'Tornado'];
- addHero(newHero) {
- if (newHero.value) {
- this.heroes.push(newHero.value);
- newHero.value = null; // clear the newHero textbox
+ addHero(newHero:string) {
+ if (newHero) {
+ this.heroes.push(newHero);
+ newHero = null; // clear the newHero textbox
}
}
}
bootstrap(LittleTour);
+enum Color {Red, Green, Blue};
+
@Component({
selector: 'my-app',
templateUrl: 'app/app.html',
@@ -194,9 +198,13 @@ class AppComponent {
callPhone(value:string) {alert(`Calling ${value} ...`)}
canSave = true;
+ Color = Color;
+ color = Color.Red;
+ colorToggle() {this.color = (this.color === Color.Red)? Color.Blue : Color.Red}
+
currentHero = Hero.MockHeroes[0];
- getStyles(el){
+ getStyles(el:Element){
let styles = window.getComputedStyle(el);
let showStyles = {};
for (var p in this.setStyles()){
@@ -220,26 +228,26 @@ class AppComponent {
nullHero:Hero = null; // or undefined
- onCancel(event){
- let evtMsg = event ? ' Event target is '+ event.target.innerHTML : '';
+ onCancel(event:KeyboardEvent){
+ let evtMsg = event ? ' Event target is '+ (