# 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 or component * a [TemplateRef](api/core/TemplateRef) from an [ng-template](api/core/ng-template) * a web component
See the for a working example containing the code snippets in this guide.
## Prerequisites * [Understanding templates](guide/template-overview) ## Syntax 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 `