From 5879e4616fe397cc6a3e8f95bd60f32bca4841a4 Mon Sep 17 00:00:00 2001 From: Virginia Dooley Date: Mon, 29 Nov 2021 18:18:08 +0000 Subject: [PATCH] docs: Understanding template variables updated (#45897) This converts the "Template variables" doc to the new "Understanding" format and remove some irrelevant content. PR Close #45897 --- .../guide/template-reference-variables.md | 211 ++++++------------ 1 file changed, 64 insertions(+), 147 deletions(-) diff --git a/aio/content/guide/template-reference-variables.md b/aio/content/guide/template-reference-variables.md index 25f0b2486d7..afa12ac8135 100644 --- a/aio/content/guide/template-reference-variables.md +++ b/aio/content/guide/template-reference-variables.md @@ -1,15 +1,14 @@ -# Template variables +# Understanding template variables Template variables help you use data from one part of a template in another part of the template. Use template variables to perform tasks such as respond to user input or finely tune your application's forms. A template variable can refer to the following: -* A DOM element within a template -* A directive -* An element -* [TemplateRef](api/core/TemplateRef) -* A [web component](https://developer.mozilla.org/docs/Web/Web_Components "MDN: Web Components") +* a DOM element within a template +* a directive or component +* a [TemplateRef](api/core/TemplateRef) from an [ng-template](api/core/ng-template) +* a web component
@@ -17,29 +16,35 @@ See the for a working example containing the code
+## Prerequisites + +* [Understanding templates](guide/template-overview) + ## Syntax -In the template, you use the hash \(`#`\) character to declare a template variable. -The following template variable, `#phone`, declares a `phone` variable on an `` element. +In the template, you use the hash symbol, `#`, to declare a template variable. +The following template variable, `#phone`, declares a `phone` variable with the `` element as its value. - + Refer to a template variable anywhere in the component's template. Here, a `