Skip to content
This repository has been archived by the owner on Jan 22, 2021. It is now read-only.

Template not binding too its template data #59

Open
brent-taft opened this issue Apr 8, 2016 · 2 comments
Open

Template not binding too its template data #59

brent-taft opened this issue Apr 8, 2016 · 2 comments

Comments

@brent-taft
Copy link

I am integrating your email template package and I am having a issue with databinding. I copied your example email template into my project. If I preview or send using the url - the email template shows up perfectly and the Beatles names are all listed.

However, if i use Mailer.send (see below) - to send the same template. The email shows up - however, the Beatles list is not in the template. I am invoking a server side meteor method using Meteor.call from the client. I can call methods defined in the template like capitalizedName - but binding to data defined in the route.data portion of the template is empty. Any ideas?

if( Meteor.isServer) {

Meteor.methods({

     sendTestMail: function () {

         console.log("sendTestMail entered");

         Mailer.send({
             to: 'xyz@hotmail.com',
             subject: 'My Test',
             template: 'sample',
             data: {
                 //user: 'user1',
                 //team: 'Team1'
             }
         })
     }
});

}

Here is the template:

Templates.sample = {
path: 'sample-email/template.html', // Relative to the 'private' dir.
scss: 'sample-email/style.scss', // Mail specific SCSS.

helpers: {
    capitalizedName : function() {
        //return this.name.charAt(0).toUpperCase() + this.name.slice(1);
        return "testcapname";
    },
    myData : function() {
        return Products.featured();
    }
},
route: {
    path: '/sample/:name',
    data: function(params) {
        return {
            name: params.name,
            names: ['Johan', 'John', 'Paul', 'Ringo'],
            testdata: ["Blah1", "Blah2"],
            test: "this is a test piece of data from the template"
        };
    }
}

};

@johanbrook
Copy link
Contributor

Thanks for reporting in, gonna have a look at this 🚀

@johanbrook
Copy link
Contributor

@brent-taft Can you set up a sample app for reproduction of this? I can't reproduce it in the example app in this package.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

2 participants