diff --git a/public/docs/_examples/template-syntax/ts/app/app.component.html b/public/docs/_examples/template-syntax/ts/app/app.component.html index f983716ee4..f0ee22ab80 100644 --- a/public/docs/_examples/template-syntax/ts/app/app.component.html +++ b/public/docs/_examples/template-syntax/ts/app/app.component.html @@ -208,9 +208,9 @@ button - +
Bad curly
+ [class]="badCurly">Bad curly @@ -370,24 +370,14 @@ After setClasses(), the classes are "{{classDiv.className}}"

setStyles returns {{setStyles() | json}}

- This div is italic, normal weight, and x-large + This div is italic, normal weight, and extra large (24px)
-
- After setStyles(), the styles are "{{getStyles(styleDiv)}}" -
- - -

Use setStyles2() - camelCase style property names

-

setStyles2 returns {{setStyles2() | json}}

- -
- This div is italic, normal weight, and x-large -
- -
- After setStyles2(), the styles are "{{getStyles(styleDiv2)}}" -
+

After setStyles(), the DOM confirms that the styles are + + "{{getStyles(styleDiv)}}" + . +

@@ -480,8 +470,8 @@ After setClasses(), the classes are "{{classDiv.className}}"
- +
{{i + 1}} - {{hero.fullName}}
diff --git a/public/docs/_examples/template-syntax/ts/app/app.component.ts b/public/docs/_examples/template-syntax/ts/app/app.component.ts index 28da87436e..4f7b0fa16a 100644 --- a/public/docs/_examples/template-syntax/ts/app/app.component.ts +++ b/public/docs/_examples/template-syntax/ts/app/app.component.ts @@ -29,6 +29,7 @@ export class AppComponent { actionName = 'Go for it'; alert = alerter; + badCurly = 'bad curly'; callFax(value:string) {this.alert(`Faxing ${value} ...`)} callPhone(value:string) {this.alert(`Calling ${value} ...`)} canSave = true; @@ -130,7 +131,7 @@ export class AppComponent { // CSS property names 'font-style': this.canSave ? 'italic' : 'normal', // italic 'font-weight': !this.isUnchanged ? 'bold' : 'normal', // normal - 'font-size': this.isSpecial ? 'x-large': 'smaller', // larger + 'font-size': this.isSpecial ? '24px' : '8px', // 24px } // #enddocregion setStyles // compensate for DevMode (sigh) @@ -143,25 +144,6 @@ export class AppComponent { } // #enddocregion setStyles - // #docregion setStyles2 - setStyles2() { - let styles = { - // camelCase style properties work too - fontStyle: this.canSave ? 'italic' : 'normal', // italic - fontWeight: !this.isUnchanged ? 'bold' : 'normal', // normal - fontSize: this.isSpecial ? 'x-large': 'smaller', // larger - } - // #enddocregion setStyles2 - // compensate for DevMode (sigh) - if (JSON.stringify(styles) === JSON.stringify(this._priorStyles2)){ - return this._priorStyles2; - } - this._priorStyles2 = styles; - // #docregion setStyles2 - return styles; - } - // #enddocregion setStyles2 - toeChoice = ''; toeChooser(picker:HTMLFieldSetElement){ let choices = picker.children; diff --git a/public/docs/ts/latest/guide/template-syntax.jade b/public/docs/ts/latest/guide/template-syntax.jade index 2b18d3b9e0..558ed1f8e5 100644 --- a/public/docs/ts/latest/guide/template-syntax.jade +++ b/public/docs/ts/latest/guide/template-syntax.jade @@ -1,59 +1,43 @@ include ../../../../_includes/_util-fns :marked - # Template Syntax - Our Angular application manages what the user sees and does through the interaction of a Component class instance and its user-facing template. + Our Angular application manages what the user sees and does through the interaction of a Component class instance (the *component*) and its user-facing template. - Many of us are familiar with the Component/Template duality from our experience with Model-View-Controller or Model-View-ViewModel. In Angular, the Component plays the part of the Controller/ViewModel and the Template represents the view. + Many of us are familiar with the component/template duality from our experience with model-view-controller (MVC) or model-view-viewmodel (MVVM). In Angular, the component plays the part of the controller/viewmodel, and the template represents the view. - Let’s find out what it takes to write a Template for our view. + Let’s find out what it takes to write a template for our view. We’ll cover these basic elements of template syntax: - We’ll cover these basic elements of Template Syntax + * [HTML](#html) + * [Interpolation](#interpolation) + * [Template expressions](#template-expressions) + * [Template statements](#template-statements) + * [Binding syntax](#binding-syntax) + * [Property binding](#property-binding) + * [Attribute, class, and style bindings](#other-bindings) + * [Event binding](#event-binding) + * [Two-way data binding with `NgModel`](#ngModel) + * [Built-in directives](#directives) + * [* and <template>](#star-template) + * [Local template variables](#local-vars) + * [Input and output properties](#inputs-outputs) + * [Template expression operators](#expression-operators) - >[HTML](#html) - - >[Interpolation](#interpolation) - - >[Template expressions](#template-expressions) - - >[Template statements](#template-statements) - - >[Binding syntax](#binding-syntax) - - >[Property Binding](#property-binding) - - >[Attribute, Class and Style Bindings](#other-bindings) - - >[Event Binding](#event-binding) - - >[Two-way data binding with `NgModel`](#ngModel) - - >[Built-in Directives](#directives) - - >[* and <template>](#star-template) - - >[Local template variables](#local-vars) - - >[Input and Output Properties](#inputs-outputs) - - >[Template Expression Operators](#expression-operators) - - [Live Example](/resources/live-examples/template-syntax/ts/plnkr.html). + [Run the live example](/resources/live-examples/template-syntax/ts/plnkr.html) .l-main-section :marked ## HTML - HTML is the language of the Angular template. Our “[QuickStart](./quickstart.html)” application had a template that was pure HTML + HTML is the language of the Angular template. Our [QuickStart](./quickstart.html) application had a template that was pure HTML: +makeExample('template-syntax/ts/app/app.component.html', 'my-first-app')(format=".") :marked - Almost all HTML syntax is valid template syntax. The `