I have a list of numbers in my Meteor Template which I am iterating to print the attributes of the object. I have an object named choices_object
which will have number of choices depending upon the situation.
objects fields will be choice_1
choice_2
choice_3
and so on.
I have the same number of values in an array as object fields.
values=[1,2,3,4,5,6,7,8,9]
In my template I have to concatenate the name of objects fields with this number to complete the names of fields.
<template name="choices_template">
{{#with choices_object}}
{{#each values}}
{{choice_ .}} <!-- it should be {{choice_1}} and so on depends on the value of dot.
{{/each}}
{{/with}}
</template>
Is it possible to concatenate a variable name as i am trying to do?
You should create a proper json for your data and then iterate directly through the values. For example: