I am using the handlebars lookup helper to lookup an object in an array based on the index.
Unfortunatelly I do not manage to output a property of the object.
HTML:
<script id="entry-template" type="text/x-handlebars-template">
<div class="entry">
<h1>Employees</h1>
<div class="body">
<ul>
<li> 1.Employee {{lookup this 0}}</li>
<li> 2.Employee {{lookup this 1}}</li>
</ul>
</div>
</div>
</script>
<div id="content">
</div>
Javascript:
var employees = [ { name : 'Joe'}, { name : 'Bob'} ];
var source = $("#entry-template").html();
var template = Handlebars.compile(source);
var html = template(employees);
$('#content').append(html);
and jsfiddle: https://jsfiddle.net/sgu2mmdz/1/
This is a simplified example to demonstrate my problem. I am aware that there are simplier ways so output the name by using the each helper
Edit: This is an updated jsfiddle with a version, which is closer to what I need to achieve: https://jsfiddle.net/sgu2mmdz/6/