简体   繁体   中英

How Do I Call a Template from Within Another Template's Helper Function When Using Meteor?

I'm am trying to call one template from within another template but I'm getting this weird output?

<!--label:qK29F4s8LzAJET2td-->

Here is my first template that is calling the other template

<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>

and here is the helper declaration

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

and the 2nd template

<template name="welcome_email">

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

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

</template>

I also tried calling the template directly from within the the other template without declearing a helper like {{> welcome_email}}

Calling the template directly should have worked and the helper is not necessary. I think the handlebars call is sensitive to extra spaces. Try:

{{>welcome_email}}

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