-6ren">
gpt4 book ai didi

javascript - 使用 Meteor 时如何从另一个模板的辅助函数中调用模板?

转载 作者:行者123 更新时间:2023-11-28 09:05:28 25 4
gpt4 key购买 nike

我正在尝试从另一个模板中调用一个模板,但我得到了这个奇怪的输出?

<!--label:qK29F4s8LzAJET2td-->

这是我的第一个模板,它调用另一个模板

<template name="messages_create">

<form id="create_email" class="container-fluid">

<input type="text" id="email_to" placeholder="Enter Recipient" value="{{contact.fullName}} <{{contact.email}}>" class="span12">

<input type="text" id="subject" placeholder="Subject" value="{{record.subject}}" class="span12">

<textarea id="body" placeholder="Body" rows="4" class="span12">{{{template}}}</textarea>

</form>

</template>

这是助手声明

Template.messages_create.template = function () {
return Template.welcome_email();
}

和第二个模板

<template name="welcome_email">

<p>Good Afternoon {{to}},</p>

<p>{{to}}, Welcome to my site!</p>

</template>

我还尝试直接从另一个模板中调用该模板,而无需声明像{{>welcome_email}}这样的帮助器

最佳答案

直接调用模板应该可以工作,并且不需要帮助程序。我认为 Handlebars 调用对额外的空格很敏感。尝试:

{{>welcome_email}}

关于javascript - 使用 Meteor 时如何从另一个模板的辅助函数中调用模板?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17177019/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com