Home
Run

Demo: Using {{tmpl}} to render hierarchical data.

TitleLanguages

Data:

var movies = [
	{ Name: "Meet Joe Black",
		Languages:[
			{ Name: "English" },
			{ Name: "French" }
		]
	},
	{ Name: "Eyes Wide Shut",
		Languages:[
			{ Name: "French" },
			{ Name: "German" } ,
			{ Name: "Spanish" }
		]
	}
];

HTML:

<script id="movieTemplate" type="text/x-jquery-tmpl">
	<tr>
		<td>${Name}</td>
		<td>{{tmpl(Languages) "#languageTemplate"}}</td>
	</tr>
</script>

<script id="languageTemplate" type="text/x-jquery-tmpl">
	<div>${Name}</div>
</script>