From ebc022e475c918719736395a0a5fdb7db077810c Mon Sep 17 00:00:00 2001 From: Filipe Silva Date: Thu, 28 Apr 2016 11:18:52 -0700 Subject: [PATCH] docs: update prose for the `let` change to ngFor --- .../cookbook/a1-a2-quick-reference.jade | 6 +- .../cookbook/component-communication.jade | 2 +- .../docs/ts/latest/guide/displaying-data.jade | 8 +- public/docs/ts/latest/guide/forms.jade | 10 +- .../ts/latest/guide/server-communication.jade | 2 +- .../latest/guide/structural-directives.jade | 5 +- .../docs/ts/latest/guide/template-syntax.jade | 113 ++++++++---------- public/docs/ts/latest/guide/user-input.jade | 12 +- public/docs/ts/latest/tutorial/toh-pt2.jade | 6 +- 9 files changed, 74 insertions(+), 90 deletions(-) diff --git a/public/docs/ts/latest/cookbook/a1-a2-quick-reference.jade b/public/docs/ts/latest/cookbook/a1-a2-quick-reference.jade index 5ce28ad2d3..6976f95af4 100644 --- a/public/docs/ts/latest/cookbook/a1-a2-quick-reference.jade +++ b/public/docs/ts/latest/cookbook/a1-a2-quick-reference.jade @@ -97,12 +97,12 @@ table(width="100%") ### Local variables +makeExample('cb-a1-a2-quick-reference/ts/app/app.component.html', 'local')(format="." ) :marked - In Angular 2, we have true local template variables that are explicitly defined using the hash (#) symbol. + In Angular 2, we have true template reference variables that are explicitly defined using the hash (#) symbol. - Using a local template variable, we can move data between elements in the template. We can use the local template + Using a template reference variable, we can move data between elements in the template. We can use the template reference variable on the same element, on sibling elements, or on any child elements. - For more information see [Template Syntax](../guide/template-syntax.html#local-vars). + For more information see [Template Syntax](../guide/template-syntax.html#ref-vars). :marked [Back to top](#top) diff --git a/public/docs/ts/latest/cookbook/component-communication.jade b/public/docs/ts/latest/cookbook/component-communication.jade index f69046e241..c9e9c91748 100644 --- a/public/docs/ts/latest/cookbook/component-communication.jade +++ b/public/docs/ts/latest/cookbook/component-communication.jade @@ -180,7 +180,7 @@ parent-to-child-local-var A parent component cannot use data binding to read child properties or invoke child methods. We can do both - by creating a template local variable for the child element + by creating a template reference variable for the child element and then reference that variable *within the parent template* as seen in the following example. diff --git a/public/docs/ts/latest/guide/displaying-data.jade b/public/docs/ts/latest/guide/displaying-data.jade index 0b2539e896..b5ce5966a9 100644 --- a/public/docs/ts/latest/guide/displaying-data.jade +++ b/public/docs/ts/latest/guide/displaying-data.jade @@ -140,12 +140,12 @@ figure.image-display .alert.is-important :marked Don't forget the leading asterisk (\*) in `*ngFor`. It is an essential part of the syntax. - Learn more about this and `NgFor` in the [Template Syntax](./template-syntax.html#ngFor) chapter. + Learn more about this and `ngFor` in the [Template Syntax](./template-syntax.html#ngFor) chapter. :marked - Notice the `#hero` in the `NgFor` double-quoted instruction. - The `#hero` is a [local template variable](./template-syntax.html#local-vars) declaration. - The `#` prefix declares a local variable name named `hero`. + Notice the `#hero` in the `ngFor` double-quoted instruction. + The `#hero` is a [template input variable](./template-syntax.html#ngForMicrosyntax) declaration. + The `let` keyword declares a local variable name named `hero`. Angular duplicates the `
  • ` for each item in the list, setting the `hero` variable to the item (the hero) in the current iteration. Angular uses that variable as the diff --git a/public/docs/ts/latest/guide/forms.jade b/public/docs/ts/latest/guide/forms.jade index 3cd1515643..8c8834e863 100644 --- a/public/docs/ts/latest/guide/forms.jade +++ b/public/docs/ts/latest/guide/forms.jade @@ -236,7 +236,7 @@ ol :marked We are repeating the `` tag for each power in the list of Powers. - The `#p` local template variable is a different power in each iteration; + The `p` template input variable is a different power in each iteration; we display its name using the interpolation syntax with the double-curly-braces. @@ -408,7 +408,7 @@ table td ng-valid td ng-invalid :marked - Let's add a temporary [local template variable](./template-syntax.html#local-vars) named **spy** + Let's add a temporary [template reference variable](./template-syntax.html#ref-vars) named **spy** to the "Name" `` tag and use the spy to display those classes. +makeExample('forms/ts/app/hero-form.component.html', 'ngControl-2','app/hero-form.component.html (excerpt)')(format=".") @@ -464,7 +464,7 @@ figure.image-display :marked To achieve this effect we extend the `` tag with - 1. a [local template variable](./template-syntax.html#local-vars) + 1. a [template reference variable](./template-syntax.html#ref-vars) 1. the "*is required*" message in a nearby `
    ` which we'll display only if the control is invalid. Here's how we do it for the *name* input box: @@ -472,7 +472,7 @@ figure.image-display 'name-with-error-msg', 'app/hero-form.component.html (excerpt)')(format=".") :marked - We need a template local variable to access the input box's Angular control from within the template. + We need a template reference variable to access the input box's Angular control from within the template. Here we created a variable called `name` and gave it the value "ngForm". .l-sub-section :marked @@ -607,7 +607,7 @@ figure.image-display wire the button's enable/disabled state to the form's validity without Angular's help? For us, it was as simple as - 1. Define a template local variable on the (enhanced) form element + 1. Define a template reference variable on the (enhanced) form element 2. Reference that variable in a button some 50 lines away. .l-main-section diff --git a/public/docs/ts/latest/guide/server-communication.jade b/public/docs/ts/latest/guide/server-communication.jade index 248aa33c14..2e286084ac 100644 --- a/public/docs/ts/latest/guide/server-communication.jade +++ b/public/docs/ts/latest/guide/server-communication.jade @@ -82,7 +82,7 @@ figure.image-display :marked Beneath the heroes is an input box and an *Add Hero* button where we can enter the names of new heroes and add them to the database. - We use a [local template variable](template-syntax.html#local-vars), `newHero`, to access the + We use a [template reference variable](template-syntax.html#ref-vars), `newHero`, to access the value of the input box in the `(click)` event binding. When the user clicks the button, we pass that value to the component's `addHero` method and then clear it to make ready for a new hero name. diff --git a/public/docs/ts/latest/guide/structural-directives.jade b/public/docs/ts/latest/guide/structural-directives.jade index ca7e15c176..ab53753ea8 100644 --- a/public/docs/ts/latest/guide/structural-directives.jade +++ b/public/docs/ts/latest/guide/structural-directives.jade @@ -212,10 +212,9 @@ figure.image-display and move the directive onto the `