diff --git a/public/docs/_examples/template-syntax/ts/src/app/app.component.html b/public/docs/_examples/template-syntax/ts/src/app/app.component.html
index b3d6c29be5..e58460bf89 100644
--- a/public/docs/_examples/template-syntax/ts/src/app/app.component.html
+++ b/public/docs/_examples/template-syntax/ts/src/app/app.component.html
@@ -158,15 +158,15 @@
-
+
-
+
-Save
+Save
click me
@@ -176,9 +176,9 @@
Hero Name:
-
+
- {{heroName}}
+ {{name}}
@@ -193,7 +193,7 @@
-
+
button
@@ -349,7 +349,7 @@ button
Style Binding
-Red
+Red
Save
@@ -402,14 +402,14 @@ button
- Save, no propagation
+ Save, no propagation
- Save w/ propagation
+ Save w/ propagation
@@ -460,21 +460,21 @@ bindon-ngModel
[ngModel]="currentHero.name"
(ngModelChange)="currentHero.name=$event">
-(ngModelChange) = "...name=$event"
+(ngModelChange)="...name=$event"
-(ngModelChange) = "setUppercaseName($event)"
+(ngModelChange)="setUppercaseName($event)"
top
NgClass Binding
-currentClasses returns {{currentClasses | json}}
+currentClasses is {{currentClasses | json}}
This div is initially saveable, unchanged, and special
@@ -489,7 +489,7 @@ bindon-ngModel
This div should be {{ canSave ? "": "not"}} saveable,
{{ isUnchanged ? "unchanged" : "modified" }} and,
- {{ isSpecial ? "": "not"}} special after clicking "refresh".
+ {{ isSpecial ? "": "not"}} special after clicking "Refresh".
This div is special
@@ -504,12 +504,12 @@ bindon-ngModel
- This div is x-large.
+ This div is x-large or smaller.
-[ngStyle] binding to `currentStyles` - CSS property names
-currentStyles returns {{currentStyles | json}}
+[ngStyle] binding to currentStyles - CSS property names
+currentStyles is {{currentStyles | json}}
This div is initially italic, normal weight, and extra large (24px).
@@ -526,7 +526,7 @@ bindon-ngModel
This div should be {{ canSave ? "italic": "plain"}},
{{ isUnchanged ? "normal weight" : "bold" }} and,
- {{ isSpecial ? "extra large": "normal size"}} after clicking "refresh".
+ {{ isSpecial ? "extra large": "normal size"}} after clicking "Refresh".
top
@@ -655,14 +655,12 @@ bindon-ngModel
NgSwitch Binding
-Pick your favorite hero
-
-
-
- {{h.name}}
-
-
-
+Pick your favorite hero
+
+
+ {{h.name}}
+
+
diff --git a/public/docs/_examples/template-syntax/ts/src/app/app.component.ts b/public/docs/_examples/template-syntax/ts/src/app/app.component.ts
index 166948362f..0b25908a01 100644
--- a/public/docs/_examples/template-syntax/ts/src/app/app.component.ts
+++ b/public/docs/_examples/template-syntax/ts/src/app/app.component.ts
@@ -31,8 +31,8 @@ export class AppComponent implements AfterViewInit, OnInit {
ngAfterViewInit() {
// Detect effects of NgForTrackBy
- trackChanges(this.heroesNoTrackBy, () => this.heroesNoTrackByCount += 1);
- trackChanges(this.heroesWithTrackBy, () => this.heroesWithTrackByCount += 1);
+ trackChanges(this.heroesNoTrackBy, () => this.heroesNoTrackByCount++);
+ trackChanges(this.heroesWithTrackBy, () => this.heroesWithTrackByCount++);
}
@ViewChildren('noTrackBy') heroesNoTrackBy: QueryList
;
@@ -42,6 +42,7 @@ export class AppComponent implements AfterViewInit, OnInit {
alert = alerter;
badCurly = 'bad curly';
classes = 'special';
+ help = '';
callFax(value: string) {this.alert(`Faxing ${value} ...`); }
callPhone(value: string) {this.alert(`Calling ${value} ...`); }
@@ -83,17 +84,9 @@ export class AppComponent implements AfterViewInit, OnInit {
title = 'Template Syntax';
- getStyles(el: Element) {
- let styles = window.getComputedStyle(el);
- let showStyles = {};
- for (let p in this.currentStyles) { // only interested in these styles
- showStyles[p] = styles[p];
- }
- return JSON.stringify(showStyles);
- }
-
- getVal() { return this.val; }
+ getVal(): number { return 2; }
+ name: string = Hero.heroes[0].name;
hero: Hero; // defined to demonstrate template context precedence
heroes: Hero[];
@@ -107,18 +100,16 @@ export class AppComponent implements AfterViewInit, OnInit {
// heroImageUrl = 'http://www.wpclipart.com/cartoon/people/hero/hero_silhoutte_T.png';
// Public Domain terms of use: http://www.wpclipart.com/terms.html
heroImageUrl = 'images/hero.png';
+ // villainImageUrl = 'http://www.clker.com/cliparts/u/s/y/L/x/9/villain-man-hi.png'
+ // Public Domain terms of use http://www.clker.com/disclaimer.html
+ villainImageUrl = 'images/villain.png';
iconUrl = 'images/ng-logo.png';
isActive = false;
isSpecial = true;
isUnchanged = true;
- nullHero: Hero = null;
-
- onCancel(event: KeyboardEvent) {
- let evtMsg = event ? ' Event target is ' + (event.target).innerHTML : '';
- this.alert('Canceled.' + evtMsg);
- }
+ get nullHero(): Hero { return null; }
onClickMe(event: KeyboardEvent) {
let evtMsg = event ? ' Event target class is ' + (event.target).className : '';
@@ -128,9 +119,10 @@ export class AppComponent implements AfterViewInit, OnInit {
onSave(event: KeyboardEvent) {
let evtMsg = event ? ' Event target is ' + (event.target).innerText : '';
this.alert('Saved.' + evtMsg);
+ if (event) { event.stopPropagation(); }
}
- onSubmit() { /* referenced but not used */}
+ onSubmit() {/* referenced but not used */}
product = {
name: 'frimfram',
@@ -144,17 +136,6 @@ export class AppComponent implements AfterViewInit, OnInit {
this.heroesWithTrackByCountReset = 0;
}
- private samenessCount = 5;
- moreOfTheSame() { this.samenessCount++; };
- get sameAsItEverWas() {
- let result: string[] = Array(this.samenessCount);
- for ( let i = result.length; i-- > 0; ) { result[i] = 'same as it ever was ...'; }
- return result;
- // return [1,2,3,4,5].map(id => {
- // return {id:id, text: 'same as it ever was ...'};
- // });
- }
-
setUppercaseName(name: string) {
this.currentHero.name = name.toUpperCase();
}
@@ -174,8 +155,8 @@ export class AppComponent implements AfterViewInit, OnInit {
// #docregion setStyles
currentStyles: {};
setCurrentStyles() {
+ // CSS styles: set per current state of component properties
this.currentStyles = {
- // CSS styles: set per current state of component properties
'font-style': this.canSave ? 'italic' : 'normal',
'font-weight': !this.isUnchanged ? 'bold' : 'normal',
'font-size': this.isSpecial ? '24px' : '12px'
@@ -190,11 +171,6 @@ export class AppComponent implements AfterViewInit, OnInit {
// #docregion trackById
trackById(index: number, item: any): number { return item['id']; }
// #enddocregion trackById
-
- val = 2;
- // villainImageUrl = 'http://www.clker.com/cliparts/u/s/y/L/x/9/villain-man-hi.png'
- // Public Domain terms of use http://www.clker.com/disclaimer.html
- villainImageUrl = 'images/villain.png';
}
// helper to track changes to viewChildren
diff --git a/public/docs/_examples/template-syntax/ts/src/app/hero-detail.component.ts b/public/docs/_examples/template-syntax/ts/src/app/hero-detail.component.ts
index 486e6ac370..725849d692 100644
--- a/public/docs/_examples/template-syntax/ts/src/app/hero-detail.component.ts
+++ b/public/docs/_examples/template-syntax/ts/src/app/hero-detail.component.ts
@@ -12,7 +12,7 @@ import { Hero } from './hero';
inputs: ['hero'],
outputs: ['deleteRequest'],
// #enddocregion input-output-2
- styles: ['button { margin-left: 8px} div {margin: 8px 0} img {height:24px}'],
+ styles: ['button {margin-left: 8px} div {margin: 8px 0} img {height:24px}'],
// #docregion template-1
template: `
@@ -34,7 +34,7 @@ export class HeroDetailComponent {
lineThrough = '';
@Input() prefix = '';
-// #docregion deleteRequest
+ // #docregion deleteRequest
// This component make a request but it can't actually delete a hero.
deleteRequest = new EventEmitter
();
@@ -44,7 +44,7 @@ export class HeroDetailComponent {
this.lineThrough = this.lineThrough ? '' : 'line-through';
// #docregion deleteRequest
}
-// #enddocregion deleteRequest
+ // #enddocregion deleteRequest
}
@Component({
diff --git a/public/docs/_examples/template-syntax/ts/src/app/hero-form.component.html b/public/docs/_examples/template-syntax/ts/src/app/hero-form.component.html
index bbd417e304..2182060439 100644
--- a/public/docs/_examples/template-syntax/ts/src/app/hero-form.component.html
+++ b/public/docs/_examples/template-syntax/ts/src/app/hero-form.component.html
@@ -1,4 +1,4 @@
-