# Render lists with a ui-bind template

> Put a Tangular template inside ui-bind with the template command to render arrays and objects whenever the data changes.

Framework: jcomponent20
Product: jComponent 20 (jcomponent@20)
Language: en
Content-SHA256: 7e72862392e0c19c808e973b30a82d3c1551828fea364d0b3e1bb0f65556d668
Snapshot: c0700e321579725c5cf4f5ace1ad7d2866d1b4f93c24a63c0b41b6b7998e976c
Sources: jcomponent20@3fedd009a277f50fddc608b97afbec553b67c51b
Review: not-recorded

With the `template` command, `<ui-bind>` renders a **Tangular** template instead of setting one value. The template is the `<script type="text/html">` inside the element; `value` is the data of the path. Every time the path changes the element is rendered again, so lists stay in sync with the state.

```html public/index.html
<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8" />
	<title>jComponent</title>
	<link rel="stylesheet" href="//cdn.componentator.com/spa.min@20.css" />
	<script src="//cdn.componentator.com/spa.min@20.js"></script>
</head>
<body>
	<ui-bind path="products" config="template">
		<script type="text/html">
			<ul>
			{{ foreach p in value }}
				<li class="product">{{ p.name }} - {{ p.price }}</li>
			{{ end }}
			</ul>
		</script>
	</ui-bind>

	<script>
		SET('products', [{ name: 'Book', price: 12 }, { name: 'Pen', price: 3 }]);
	</script>

</body>
</html>
```
