# Template variables
# 模板变量
Template variables help you use data from one part of a template in another part of the template.
With template variables, you can 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
模板中的 DOM 元素
* a directive
指令
* an element
元素
* [TemplateRef](api/core/TemplateRef)
* a web component
[Web 组件](https://developer.mozilla.org/en-US/docs/Web/Web_Components "MDN:Web Components")
See the for a working example containing the code snippets in this guide.
本章包含代码片段的工作实例参阅。
## Syntax
## 语法
In the template, you use the hash symbol, `#`, to declare a template variable.
The following template variable, `#phone`, declares a `phone` variable on an `` element.
在模板中,要使用井号 `#` 来声明一个模板变量。下列模板变量 `#phone` 语法在 `` 元素上声明了一个名为 `phone` 的变量
You can refer to a template variable anywhere in the component's template.
Here, a `