in my template,i have a select
<select name="component" id="component" >
{{#each componentList}}
<option value="{{_id}}">{{name}}</option>
{{/each}}
</select>
in template helper ,i have a componentList (writen in coffeescript).
code one
Template.adminEdit.helpers
'componentList': ->
Components.find()
code two
Template.adminEdit.helpers
'componentList': ->
[
{_id: '6K8unLsmxSFFo33zx', name: 'wordpress'}
{_id: '9hCGkpq7kEG4WnReA', name: 'drupal'}
{_id: 'vASDPxAYqhS6ofi9P', name: 'ngnix'}
]
only use code two ,i can select one option in rendered
$("#component").val("9hCGkpq7kEG4WnReA")
but i am sure the Components.find()
is the same result.
how can i change code one to work
thanks!