I'm trying to figure out how to use dynamic templates correctly in my meteor application.
First, I have a set of templates to be inserted dynamically, e.g. moduleSearch, which contains a search form:
template(name='moduleSearch')
input(placeholder='search', type='text')
My header template looks as follow:
template(name='header')
each modules
li
+UI.dynamic template=this data=objectsList
Each of the yield templates includes the header template with a dynamically changing set of modules, depending on the current yield template. E.g. My objectsList template..
template(name='objectsList')
+UI.dynamic template='headerYield' data=modules
..includes the moduleSearch template:
Template.objectsList.helpers({
modules: function() {
return ['moduleSearch'];
}
All the templates are displayed properly, as expected. The moduleSearch template contains a search form, to query the collection items at the objectsList template, however, it doesn't work. How can I get the parental context (access objectList's data & helper functions from moduleSearch)?
PS - When I copy-paste the content of the moduleSearch template into the objectsList template, the search feature works, data is being filtered reactively in this case.