Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What causes "Template is not defined" in Meteor?

Tags:

This extremely simple Meteor app is throwing a Template is not defined error on load. The app is essentially identical to the boilerplate project (meteor create), just split into server/client/public directories.

Meteor seems to be trying to render the Handlebars template tags before the global Template object is actually ready. By the time I can get to the JS console and type "Template", it is there.

Have I done something wrong, or is this a timing bug?

like image 840
mwcz Avatar asked May 04 '12 03:05

mwcz


1 Answers

You need to make sure in your .js file which calls the Template is wrapped in if (Meteor.isClient){}, otherwise the Template global var won't be available for some reason.

like image 67
KJW Avatar answered Oct 26 '22 20:10

KJW