javascript - Referencing handlebars variable in a loop -
i trying build dropdowns in handlebars using compiled template not able access 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
, opts
arrays of objects.
the select helper handlebars-form-helpers, in normal handlebars ({{../bond_service_request_quantities.0.text}}
) error.
uncaught typeerror: cannot read property '1' of undefined
my answer using 2 different versions of handlebars. project has v2.0.0 npm installed 3.0.3 grunt task compiles templates.
Comments
Post a Comment