Meteor templates not working

I'm still very new to Meteor, so I'm guessing I'm confused about something very simple.

I'm trying to create a super simple hello world with templates and just insert a string into it.

## client/body.html ##
<body>
    <div>
        {{> greeter }}
    </div>
</body>

## client/templates/greeter.html ##
<template name="greeter">
    <h1>Hello {{ name }}</h1>
</template>

## client/greeter.js ##
Template.greeter({ name: "giodamelio" });

      

My conclusion is simply

<h1>Hello </h1>

      

Why is my template not showing?

+3


source to share


1 answer


Your template is rendering, but there are three problems: (1) change name

to myName

or something because it is a reserved word, (2) collapse {{ name }}

into {{myName}}

(no spaces); and (3) {{myName}}

will still be empty because your connection code is slightly off. Replace what you have in greeting.js with this:



Template.greeter.myName = function() {
   return "giodamelio"
};

      

+3


source







All Articles