Partager via


QueryCollection.template method

Renders a template that is bound to the given data and parented to the elements included in the QueryCollection. If the QueryCollection contains multiple elements, the template is rendered multiple times, once at each element in the QueryCollection per item of data passed.

Syntax

var queryCollection = queryCollection.template(templateElement, data, renderDonePromiseCallback);

Parameters

  • templateElement
    Type: DOMElement

    The DOM element to which the template control is attached.

  • data
    Type: Object

    The data to render. If the data is an array (or any other object that has a forEach method) then the template is rendered multiple times, once for each item in the collection.

  • renderDonePromiseCallback
    Type: Function

    If supplied, this function is called each time the template gets rendered, and is passed a promise that is fulfilled when the template rendering is complete.

Return value

Type: QueryCollection

The QueryCollection.

Requirements

Minimum WinJS version

WinJS 1.0

Namespace

WinJS.Utilities

See also

QueryCollection