How do you use a reference variable in a template?

How do you use a reference variable in a template?

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. Refer to a template variable anywhere in the component’s template. Here, a further down the template refers to the phone variable.

Can we use template reference variable in component?

A template reference variable is often a reference to a DOM element within a template. It can also be a reference to an Angular component or directive or a web component (Read more at Angular.io). However, you can use ViewChild decorator to reference it inside your component.

How do I pass a template reference variable in component?

To create a template reference variable, locate the HTML element that you want to reference and then tag it like so: #myVarName . In the code below, a template reference variable is created that references the with id test-div .

What does template reference variable contain?

Template reference variables ( #var )link. A template reference variable is often a reference to a DOM element within a template. It can also refer to a directive (which contains a component), an element, TemplateRef, or a web component. Use the hash symbol (#) to declare a reference variable.

How do I access ng-template in component?

1 Answer

  1. 1 – Import TemplateRef and ViewChild, example: import { TemplateRef, ViewChild } from ‘@angular/core’;
  2. 2 – Create the variable that binds the ngtemplate (add before constructor): @ViewChild(‘content’) private content: TemplateRef;
  3. 3 – Open modal from typescript: this.modalService.open(this.content);

Can you create templates in Confluence?

Create a template You can write your template using the Confluence editor. You can also add special variables to the page, if you want to include fields that the author will complete when adding the page. See Create a Template for more information.

How do I use Confluence templates?

Using a template to create a page

  1. Choose Create from template in the Confluence header.
  2. Select a space and the template you want to use and choose Next.
  3. Type the relevant information into the form fields, and choose Next.
  4. Name your page, add content or make any other changes required and hit Save.

How do I access ng template in component?