Class Template

Provides a reusable declarative binding element.

Index

Constructor methods

Properties

Constructor methods

constructor(element: HTMLElement, options?: string): Template

Creates a template that provides a reusable declarative binding element.

constructor

Parameters

  • element: HTMLElement

    The DOM element to convert to a template.

  • options?: string optional

    If this parameter is supplied, the template is loaded from the URI and the content of the element parameter is ignored. You can add the following options: href.

Returns

Template

Properties

public bindingInitializer: any

Gets or sets the default binding initializer for the template.

public debugBreakOnRender: boolean

Gets or sets a value that specifies whether a debug break is inserted into the first rendering of each template. This property only has an effect when the app is in debug mode.

public disableOptimizedProcessing: boolean

This property is deprecated and might not be available in future versions of the WinJS. Gets or sets a value that specifies whether optimized template processing has been disabled.

public element: HTMLElement

Gets the DOM element that is used as the template.

public extractChild: boolean

Gets a value that specifies whether templates should be instantiated without the creation of an additional child element.

public isDeclarativeControlContainer: boolean

Determines whether the Template contains declarative controls that must be processed separately. This property is always true. The controls that belong to a Template object's children are instantiated when a Template instance is rendered.

public render: { value(href: string, dataContext: any, container?: HTMLElement): WinJS.Promise<HTMLElement>; (dataContext: any, container?: HTMLElement): WinJS.Promise<HTMLElement>; }

(): Promise

Binds values from the specified data context to elements that are descendants of the specified root element that have the declarative binding attributes specified (data-win-bind).

Returns

Promise

A Promise that will be completed after binding has finished. The value is either container or the created DIV. promise that is completed after binding has finished.

public value(): Promise

Renders a template based on the specified URI (static method).

Returns

Promise

A promise that is completed after binding has finished. The value is either the object in the container parameter or the created DIV.

optional .container.container?: HTMLElement

.dataContext.dataContext: any

.href.href: string