JsRender Demos
Example Scenario: Accessing parent data.
Stepping up through the views (tree of nested rendered templates)
var model = {
specialMessage: function(...) { ... },
theater: "Rialto",
movies: [ ... ]
}
{{for movies}}
<tr>
<td>'{{>title}}': showing at the '{{>#parent.parent.data.theater}}'</td>
Title | Languages (+specialMessage) |
Setting contextual template parameters, accessible in all nested contexts as ~nameOfParameter:
{{for movies ~theater=theater}}
<tr>
<td>'{{>title}}': showing at the '{{>~theater}}'</td>
Title | Languages (+specialMessage) |
Using the top-level data, accessible in all nested contexts as ~root:
{{for movies}}
<tr>
<td>'{{>title}}': showing at the '{{>~root.theater}}'</td>
Title | Languages (+specialMessage) |