How Do I Reference Different Sub-Templates from Different Templates in Meteor?

Juliomac

I have 5 templates. Two Templates call One that, in turn, call the other two depending from which template it was called from.

I want to do the following:

<template name="Template1">
   <!-- show his things -->
   {{BaseTemplate SubTemplate1}}
</template>

<template name="Template2">
   <!-- show his things -->
   {{BaseTemplate SubTemplate2}}
</template>

<template name="BaseTemplate">
   {{#each xpto}}
     <!-- show base things -->
     {{BaseTemplate {{CallSubTemplateGiven}} }}
   {{/each}}
</template>

<template name="SubTemplate1">
   <!-- show few things -->
</template>

<template name="SubTemplate2">
   <!-- show other things -->
</template>

Is there a way to do it? Could not figure out how to do it with RegisterHelper.

bluebird

You should be able to do it by passing the sub template as an argument to the base template, and then using template.dynamic to render the right one.

 <template name="Template1">
               {{> BaseTemplate subtemplate=SubTemplate1 }}
</template>

<template name="Template2">
               {{> BaseTemplate subtemplate=SubTemplate2 }}
</template>

<template name="BaseTemplate">
    {{#each xpto}}
               {{> Template.dynamic template=../subtemplate }}
    {{/each}}
</template>

<template name="SubTemplate1">

</template>


<template name="SubTemplate2">

</template>

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How do I call templates with same names at different directories in Django?

From Dev

How Do I Nest Meteor Spacebars Templates?

From Dev

Angular: How can I use different templates for different views?

From Dev

How to do recursive templates in Meteor?

From Dev

How do templates work in Meteor?

From Dev

How do I get templates inserted from custom block helpers to be individually rerendered in Meteor?

From Dev

How do I get template object data to persist in Meteor templates?

From Dev

How do I get Lazybones to process sub-templates?

From Dev

How is it possible to call function from different templates in blazeComponent?

From Dev

How can I use meteor templates with Bootbox?

From Dev

How can I avoid duplicate templates in Meteor?

From Dev

Show templates from different components on same place

From Dev

meteor - change contents of HTML <head> section for different templates?

From Dev

Any way to scope functions to a group of different templates in Meteor?

From Dev

LongListSelector Items with different Templates

From Dev

Render different templates for ListView

From Dev

Django - different media for different templates

From Dev

Different static files in different templates

From Dev

how to use ListView class for two different templates

From Dev

How to render different show templates conditionally

From Dev

How to handle different templates by server groups in Chef?

From Dev

How do I import templates from another stylesheet?

From Dev

How to import templates with sub-templates in a wiki

From Dev

How to bind XDocument to TreeView with different data templates for different element levels?

From Dev

How to associate different templates with different file extensions in Microsoft Word?

From Dev

How to call different directive templates based on different kinds of objects in collection?

From Dev

Meteor: Get data to use on sub templates

From Dev

How do I indicate 'checked' or 'selected' state for input controls in Meteor (with spacebars templates)?

From Dev

Use common templates for different states

Related Related

  1. 1

    How do I call templates with same names at different directories in Django?

  2. 2

    How Do I Nest Meteor Spacebars Templates?

  3. 3

    Angular: How can I use different templates for different views?

  4. 4

    How to do recursive templates in Meteor?

  5. 5

    How do templates work in Meteor?

  6. 6

    How do I get templates inserted from custom block helpers to be individually rerendered in Meteor?

  7. 7

    How do I get template object data to persist in Meteor templates?

  8. 8

    How do I get Lazybones to process sub-templates?

  9. 9

    How is it possible to call function from different templates in blazeComponent?

  10. 10

    How can I use meteor templates with Bootbox?

  11. 11

    How can I avoid duplicate templates in Meteor?

  12. 12

    Show templates from different components on same place

  13. 13

    meteor - change contents of HTML <head> section for different templates?

  14. 14

    Any way to scope functions to a group of different templates in Meteor?

  15. 15

    LongListSelector Items with different Templates

  16. 16

    Render different templates for ListView

  17. 17

    Django - different media for different templates

  18. 18

    Different static files in different templates

  19. 19

    how to use ListView class for two different templates

  20. 20

    How to render different show templates conditionally

  21. 21

    How to handle different templates by server groups in Chef?

  22. 22

    How do I import templates from another stylesheet?

  23. 23

    How to import templates with sub-templates in a wiki

  24. 24

    How to bind XDocument to TreeView with different data templates for different element levels?

  25. 25

    How to associate different templates with different file extensions in Microsoft Word?

  26. 26

    How to call different directive templates based on different kinds of objects in collection?

  27. 27

    Meteor: Get data to use on sub templates

  28. 28

    How do I indicate 'checked' or 'selected' state for input controls in Meteor (with spacebars templates)?

  29. 29

    Use common templates for different states

HotTag

Archive