Angular

Template Variables

Angular / Template Variables

Template Variables

What are Template Variables?

Template variables are variables available in the context of template. Angular does not allow the developer to create a new variable in the template. Instead, it allows new variables to be passed into the template through a component or directive instance. Also, it allows to declare a variable in the template and refers to any of the existing elements available in the template.

Types of Template Variables

There are two types of template variables −

  • Template input variable: Template input variables are passed into the template either through component or directive instance.
  • Template reference variable: Template reference variables are declared in the template itself and refer to the existing element in the template.

Template Input Variable

Template input variables are variables passed into the template and available in the context of template. They are passed into the template through multiple channels. They are as follows:

  • Component: Component exposes all its public variables/properties to it's template
  • Directive: Directive exposes selective variables into the template during its execution. 
Technology
Angular
want to connect with us ?
Contact Us