Then I have the following template, within which I would like to render a different template based on the value of a session variable < / P>
& lt; Template name = "selectionframe" & gt; & Lt; Div class = "container" & gt; & Lt; Div class = "framecarusel" & gt; {{& Gt; Template.dynamic template = active data = this}} & lt; / Div & gt; & Lt; / Div & gt; & Lt; / Template & gt;
My session variable, the board is set from the previous template and I want to make changes. I have the value to activate a template, a template assistant who can be seen below.
Template.selectFrame.helpers ({active: function () {return Session.get ('board');}}); Template.body.events ({'click .btn-primary': function (event) {event.preventDefault (); console.log (event.target.id); session.set ('board', event.target.id );}});
The value of the board is set to the name of four different templates, which I would like to be dynamic. Currently, only the session default value is returned with its corresponding template.
What should be added to allow each template to appear as my session variable changes?
If there are only 4 templates, it is ok to use the if-else statement as a general solution . In the case of many templates, I'm not sure about the solution, just wait for some supporters to help :)
No comments:
Post a Comment