Files
meteor/packages/templating/dynamic.html
2015-10-12 22:03:46 -07:00

24 lines
1.0 KiB
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}}{{> Template.contentBlock}}{{/__dynamicWithDataContext}}
{{else}}
{{! if there was no explicit 'data' argument, use the parent context}}
{{# __dynamicWithDataContext template=template data=..}}{{> Template.contentBlock}}{{/__dynamicWithDataContext}}
{{/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}}
{{!-- The .. is evaluated inside {{#with ../data}} --}}
{{# .. ../data}}{{> Template.contentBlock}}{{/ ..}}
{{/with}}
</template>