Files
meteor/packages/spacebars/dynamic.html
2014-07-25 15:01:00 -07:00

23 lines
917 B
HTML

<!-- Expects the data context to have a `template` property (the name of
the template to render) and an optional `data` property. If the `data`
property is not specified, then the parent data context will be used
instead. Uses the __dynamicWithDataContext template below to actually
render the template. -->
<template name="__dynamic">
{{checkContext}}
{{#if dataContextPresent}}
{{> __dynamicWithDataContext}}
{{else}}
{{! if there was no explicit 'data' argument, use the parent context}}
{{> __dynamicWithDataContext template=template data=..}}
{{/if}}
</template>
<!-- Expects the data context to have a `template` property (the name of
the template to render) and a `data` property, which can be falsey. -->
<template name="__dynamicWithDataContext">
{{#with chooseTemplate template}}
{{> .. ../data}} {{!-- The .. is evaluated inside {{#with ../data}} --}}
{{/with}}
</template>