Suppose I have an outer template that contains an each block. This each block creates instances of an inner template. I want to pass data from the outer template to the innner template inside the each block. How do I pass data from the outer template to the inner template?
For example :
<template name='outer'>
<!-- Works fine -->
{{ >inner item=this.getSpecificItem list=getList }}
<!-- Context is changed inside each block, can not access parent data -->
{{ #each getItems }}
{{ >inner item=this list=getList }}
{{ /each }}
</template>
Template.outer.helpers({
getSpecificItem: function () {
return Items.findOne(this.itemId);
}
getList: function () {
return Lists.findOne(this.listId);
},
getItems: function () {
return Items.find({listId: this.listId});
},
});