I have a small issue…
Simple Blaze template wich contains a modal form to add an entry into a collection.
All fine, working as it should, except for one thing, that I would like to load values from a collection into a select field. I have subscribed to the collection in my template helper. Now, the helper works, as it gets data IF i place the helper everywhere on my modal EXCEPT withing the HTML select tag…
Not working, but i try to achieve:
<div id="addModal" class="modal">
<div class="modal-content">
<form class="add-ci-form">
<div class=" input-field">
<select>
{{#each clients}}
<option value="{{client}}">{{client}}</option>
{{/each}}
</select>
</div>
</form>
</div>
</div>
Placing the {{#each}} like this renders the clients collection data perfectly withing the div.
<div id="addModal" class="modal">
<div class="modal-content">
<form class="add-ci-form">
<div class=" input-field">
{{#each clients}}{{client}}{{/each}}
<select>
{{#each clients}}
<option value="{{client}}">{{client}}</option>
{{/each}}
</select>
</div>
</form>
</div>
</div>
So, it seems that doing this within the HTML tag of select is the problem…or I am stupid, or there is something else going on. I have other selects in the same form with manual values, and they work. Letting my helper return an array of values instead of a collecton works as well.
Using Meteor 1.7 with Materialize:Materialize.