I'm new to meteor, my question is like this. I want to make a select with option lists like:
<ul id="collapseFour" class="collapse">
<select id="uhd">
{{#each uhdNum}}
<option>{{number}}</option>
{{/each}}
</select>
</ul>
I know that I can do it by helpers, but I don't know how to do it. Instead of number there must be 1,2,3,4 up to 50. I created helper file
UHDResults = new Meteor.Collection('uhdResults');
Template.adminLayout.helpers({
uhdNum: function() {
var number;
for(var i=0;i<49;i++){
number[i] = i;
}
return number;
}
});
But there are no effect. Any help will be appreciated. Thank you!
Inside the #each
block, replace <option>{{number}}</option>
with <option>{{this}}</option>
.
In your js file, number should be defined as an array like so:
var number = [];
Everything else should work. If there is still problems, replace:
number[i] = i;
with
number.push(i);