javascript - Return Multiple Values in Meteor for Handlebars Template -
how do in meteor?
template.foo.bar = function() { somevar = homecoming value of other function homecoming somecollection , somevar; }
-------template----
{{#each somecollection}} {{somevar}} {{somecollectionfield}} {{/each}}
in regular javascript utilize array homecoming multiple values how work in meteor?
you homecoming js object , utilize handlebars go through it
client js
template.foo.bar = function() { somevar = getmyotherfunction(); homecoming { somecollection: somecollection.find({...}), somevar: somevar }; }
client html
<template name="foo"> {{#each bar.somecollection}} {{bar.somevar}} {{somecollectionfield}} {{/each}} </template>
you can access bar value within handlebars each loop , utilize .
within objects. arrays work, utilize .0
first item in array, 0 beingness index.
javascript meteor
No comments:
Post a Comment