Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
10
rated 0 times [  13] [ 3]  / answers: 1 / hits: 17050  / 12 Years ago, fri, may 4, 2012, 12:00:00

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?


More From » meteor

 Answers
4

Hm, perhaps this will solve your issue:



Note that the body tag includes the template name but not the template:



<body>
{{> hello}}
</body>

<template name=hello>
{{greet}}
</template>


Also, note that .greet refers to {{greet}}:



if (Meteor.isClient) {
Template.hello.greet = function () {
return Hey!;
};
}


So, the issue was that you can't have a template inside the body. Instead, the body calls the template with {{> hello}} as in the above code.


[#85802] Thursday, May 3, 2012, 12 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
darleneh

Total Points: 231
Total Questions: 110
Total Answers: 94

Location: Spain
Member since Thu, Dec 23, 2021
2 Years ago
;