@microsoft/fast-element > ViewTemplate

ViewTemplate class

A template capable of creating HTMLView instances or rendering directly to DOM.

Signature:

export declare class ViewTemplate<TSource = any, TParent = any> implements ElementViewTemplate, SyntheticViewTemplate 

Constructors

Constructor Modifiers Description
(constructor)(html, directives) Creates an instance of ViewTemplate.

Properties

Property Modifiers Type Description
directives ReadonlyArray<HTMLDirective> The directives that will be connected to placeholders in the html.
html string | HTMLTemplateElement The html representing what this template will instantiate, including placeholders for directives.

Methods

Method Modifiers Description
create(hostBindingTarget) Creates an HTMLView instance based on this template definition.
render(source, host, hostBindingTarget) Creates an HTMLView from this template, binds it to the source, and then appends it to the host.