Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError : object is not a function #132

Closed
Kenpa opened this issue Jul 14, 2015 · 2 comments
Closed

TypeError : object is not a function #132

Kenpa opened this issue Jul 14, 2015 · 2 comments

Comments

@Kenpa
Copy link

Kenpa commented Jul 14, 2015

Hi,

I dont understand why I keep having this error. I'm using postmark btw

Here's my code :

var EmailTemplate = require('email-templates').EmailTemplate;
var templatesDir = path.resolve(__dirname, '../templates');
var template = new EmailTemplate(path.join(templatesDir, 'register'));
var locals = { url : someurl };

template(locals, function (err, results) { ... });

The problem is that template is an object and not a function ... here is what I got when I console.log(template) :

{ files : {}, 
  path : somepath, 
  dirname : 'register', 
  options : {} 
}
@jeduan
Copy link
Contributor

jeduan commented Jul 14, 2015

Hi! What version of the library are you using? Can you confirm you are on 2.0 by typing npm update?

@jeduan
Copy link
Contributor

jeduan commented Jul 14, 2015

Actually, I see the error. The postmark example is wrong. You should be using

template.render(locals, function (err, results) {
  ...
})

@jeduan jeduan closed this as completed in aa8c6da Jul 17, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants