mongodb - Rendering elements of an array from a document in Meteor -


i'm extremely new meteor , haven't been able find answer that's laughably simple.

i have meteor collection called ingredients:

ingredients = new mongo.collections("ingredients"); if (meteor.isclient) {    template.body.helpers({       ingredients: function() {          return ingredients.find({});    }); } 

which populated documents following:

{ name: boneless pork chop,   tags: [paleo, pork, local] } 

right i'm rendering name in template, follows:

<template name="ingredient">    <tr>       <td>{{name}}</td>    </tr> </template> 

what need figure out how render individual elements of 'tags' array in template. preferably, i'd render them in such way later assign click event each of them individually removed or edited... earlier reading means might want put tags in own collection , join them ingredients documents id, find me if that's better pattern.

little help? thanks!

you can use #each print array in meteor.

<template name="ingredient">     <tr>         <td>{{name}}</td>         <td>           {{#each tags}}             {{this}}           {{/each}}         </td>     </tr> </template> 

Comments

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -