javascript - Meteor: Accessing another collection with an id in an #each block -
so have 2 collections, appliers & profiles,
appliers = {_id,idappliersprofile}
&
profile = {_id,profilename}
so question if #each appliers, how access profile collection profile instead of id? thanks.
assuming both sets of docs published client, 1 solution looks this:
html
<template name="mytemplate"> {{#each appliers}} {{#with getprofile idappliersprofile}} <div>{{profilename}}</div> {{/with}} {{/each}} </template>
js
template.mytemplate.helpers({ appliers: function () { return appliers.find(); }, getprofile: function (id) { return profile.findone(id); } });
Comments
Post a Comment