Unable to read helpers of undefined properties

The meteor is out of beta and I’m very happy to use it. I installed it on my Windows machine (from http://win.meteor.com/ ) and created the application. Here is the code:

HTML:

<!-- simple-todos.html -->
<head>
  <title>Todo List</title>
</head>

<body>
  <div class="container">
    <header>
      <h1>Todo List</h1>
    </header>

    <ul>
      {{#each tasks}}
        {{> task}}
      {{/each}}
    </ul>
  </div>
</body>

<template name="task">
  <li>{{text}}</li>
</template>

JavaScript:

// simple-todos.js
if (Meteor.isClient) {
  // This code only runs on the client
  Template.body.helpers({
    tasks: [
      { text: "This is task 1" },
      { text: "This is task 2" },
      { text: "This is task 3" }
    ]
  });
}

This is the same code as in the official test. If I run this example, the title will display just fine. The list, on the other hand, is not displayed at all. One way or another, assistants do not work. I get the following javascript error:

Uncaught TypeError: Unable to read "helpers" of undefined properties

. , , , , (, ) . , ( ).

+4
1

<template name="xxx">.

<body> .

:

Template.registerHelper("tasks", function() {
    return [....]
});

<template name="body">:

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

<template name="body">
  <div class="container">
    <header>
      <h1>Todo List</h1>
    </header>

    <ul>
      {{#each tasks}}
        {{> task}}
      {{/each}}
    </ul>
  </div>
</template>
+5

All Articles