I am trying to build some dropdowns in Handlebars using a compiled template but it is not able to access my variable:
Handlebars:
{{#each options}}
<div class="control-group consumables-options">
<div class="row-fluid">
<div class="span2">
{{select 'task_services_options' ../bond_service_request_quantities quantity}}
</div>
</div>
</div>
{{/each}}
JS:
var html = Handlebars.templates.service_request_consumable_options({
bond_service_request_quantities: bond_quantities,
options: opts
});
Where bond_quantities
and opts
are Arrays of Objects.
The select helper is from handlebars-form-helpers, but even in normal handlebars ({{../bond_service_request_quantities.0.text}}
) I get an error.
Uncaught TypeError: Cannot read property '1' of undefined
My answer is that I was using two different versions of Handlebars. The project has v2.0.0 but npm installed 3.0.3 for the grunt task which compiles the templates.