<!DOCTYPE html>
<html>
<head>
	<script src="/usr/share/javascript/jsquery/jquery.min.js" type="text/javascript"></script>
	<script src="/usr/share/javascript/jsrender/jsrender.min.js" type="text/javascript"></script>
	<link href="../resources/demos.css" rel="stylesheet" type="text/css" />

	<link href="../resources/movielist.css" rel="stylesheet" type="text/css" />
</head>
<body>
<a href="../demos.html">JsRender Demos</a><br />

<h3>Using {{for}} to render hierarchical data - inline nested template.</h3>

<script id="movieTemplate" type="text/x-jsrender">
	<tr>
		<td>{{>title}}</td>
		<td>
			{{for languages}}
				<div>
					<em>{{>name}}</em>
				</div>
			{{/for}}
		</td>
	</tr>
</script>

<table>
	<thead><tr><th>Title</th><th>Languages</th></tr></thead>
	<tbody id="movieList"></tbody>
</table>

<script type="text/javascript">

	var movies = [
		{
			title: "Meet Joe Black",
			languages: [
				{ name: "English" },
				{ name: "French" }
			]
		},
		{
			title: "Eyes Wide Shut",
			languages: [
				{ name: "French" },
				{ name: "Mandarin" },
				{ name: "Spanish" }
			]
		},
		{
			title: "The Inheritance",
			languages: [
				{ name: "English" },
				{ name: "German" }
			]
		}
	];

	$( "#movieList" ).html(
		$( "#movieTemplate" ).render( movies )
	);

</script>

</body>
</html>


