Sorry, the topic title is probably confusing. Here is what I am trying to do.
I have two divs in my template. let’s call them div1 and div2. When the page loads div2 is hidden. The user is asked to create a list, with a name and description. Then they click next, at which point the following happens:
- A new document is created in the database
- A session variable with the document id is set
- div1 is hidden and div2 is shown.
In div 2, the user is asked to create list items. The list items are inserted in the document created in div1. I would like to show the list items in div2 in a “ul” as they are added.
Here is my template code right now.
<template name="newListItems">
{{#each items}}
<li>-- {{this.itemName}}</li>
{{/each}}
and the corresponding javascript.
Template.newListItems.helpers({
items : function(_currentListId){
if (_currentListId) {
return Lists.find(_currentListId, {fields : {"items.itemName":1, _id:0}});
}
}
});
Unfortunately, this does not display the item names. Any suggestions to help me fix this would be much appreciated. Of course, if I am missing any piece of information that you need, please let me know.
Thanks a bunch in advance for your assistance.
Kamal