I've a Handlebar template (actually a Moustache template) as
<script id="thumbnail" type="text/x-handlebars-template">
{{#available}}
<div class="thumbnail" style="left: {{#coordx}}{{@index}}{{/coordx}};">
Test Index is {{@index}}
</div>
{{/available}}
</script>
Here's the data context I'm using.
var generateThumbnails = {
"available": [
"Ruby",
"Javascript",
"Python",
"Erlang",
"more"
],
coordx : function () {
return someValue;
}
};
On the fly, I'm generating the left css margin as coordx
with the function coordx
.
In the template, I want to pass the {{@index}}
which is used to generate the left margin (which is not working). Like explained at calling function with arguments in mustache javascript
How should I pass the index so that I can get the margin value?