简体   繁体   中英

Templates inside Templates in Meteor

This should be simple, but I can't find an answer.

I have two simple handlebars templates as follows:

<template name="streams">
    <div class="container">
        <div class="row-fluid">
            {{#each streamItems}}
                {{> stream}}
            {{/each}}
        </div>
    </div>
</template>

<template name="stream">
    <div class="span4">
        <h1>{{title}}</h1>
    </div>
</template>

And some Meteor js as follows:

Template.streams.streamItems = function () {
  return [
    {title: "Stream One Title"},
    {title: "Stream Two Title"}
  ];
};

Right now this combo throws an error, but when I replace the call to the "stream" template with the content from that template it works.

<template name="streams">
    <div class="container">
        <div class="row-fluid">
            {{#each streamItems}}
               <div class="span4">
                  <h1>{{title}}</h1>
               </div>
            {{/each}}
        </div>
    </div>
</template>

Is there any way to get this to work with the separate templates?

原来是服务器错误-通过重新安装解决。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM