@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<TSource, TParent>, SyntheticViewTemplate<TSource, TParent> 

Implements: ElementViewTemplate<TSource, TParent>, SyntheticViewTemplate<TSource, TParent>

Constructors

Constructor

Modifiers

Description

(constructor)(html, factories, policy)

Creates an instance of ViewTemplate.

Properties

Property

Modifiers

Type

Description

factories

readonly

Record<string, ViewBehaviorFactory>

The directives that will be connected to placeholders in the html.

html

readonly

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.

create(strings, values, policy)

static

Creates a template based on a set of static strings and dynamic values.

inline()

Returns a directive that can inline the template.

render(source, host, hostBindingTarget)

Creates an HTMLView from this template, binds it to the source, and then appends it to the host.

withPolicy(policy)

Sets the DOMPolicy for this template.