Using an External Template

Most of the time, the easiest option is to define a Repeater template as the inner content of the Repeater as I did in the previous section. However, you also have the option of creating an external Repeater template.

Here’s an example. Listing 7.9 contains two controls: a Repeater control and a separate Template control. The Repeater is associated with the template through its template property.

LISTING 7.9 Repeater with an External Template (repeaterExternal\repeaterExternal.html)

<table style="display:none"><tbody id="productRowTemplate" data-win-control="WinJS.Binding.Template">    <tr>        <td data-win-bind="textContent:id"></td>        <td data-win-bind="textContent:name"></

Get Windows® 8.1 Apps with HTML5 and JavaScript Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.