English 中文(简体)
Handlebars Exception
原标题:
  • 时间:2012-04-11 06:51:35
  •  标签:
  • meteor

Any hints what the following exception might be about?

Running on: http://localhost:3000/ No dependency info in bundle. Filesystem monitoring disabled. Errors prevented startup: Exception while bundling application: Error

at Object.<anonymous> (/usr/local/meteor/lib/node_modules/handlebars/lib/handlebars/utils.js:11:34)
at Module._compile (module.js:441:26)
at Object..js (module.js:459:10)
at Module.load (module.js:348:32)
at Function._load (module.js:308:12)
at Module.require (module.js:354:17)
at require (module.js:370:17)
at Object.<anonymous> (/usr/local/meteor/lib/node_modules/handlebars/lib/handlebars.js:6:1)
at Module._compile (module.js:441:26)
at Object..js (module.js:459:10)

My HTML:

<head>
    <title>dinokiller</title>
</head>
<body>
    <div id="outer">
        <div>
            {{> dinostemp}}
        </div>
    </div>
</body>

<template name="dinostemp">
    {{#each dinos}}
                <div>
                    <img src="{{pix}}"/>
                </div>
    {{/dinos}}
</template>

And JS:

Dinos = new Meteor.Collection("dinos");
// On server startup, create some dinos if the database is empty.
if (Meteor.is_server) {
  Meteor.startup(function () {
    if (Dinos.find().count() === 0) {
      var dinoPix = ["https://encrypted-tbn2.google.com/images?q=tbn:ANd9GcRwVgHngNuY25hibRmniM1xsVhSlyf_ksctjjVMZ11zmX_kxzfe8w",
                    "https://encrypted-tbn2.google.com/images?q=tbn:ANd9GcRFcKunc_qEdRzqyPgKGMHdSbwaiaiqGYMr8rfoRtBKNVf_U8O-",
                   "https://encrypted-tbn1.google.com/images?q=tbn:ANd9GcQbBCccfaS4QqAWrvUSxqyATiKMIitU5YMkdxJfo6ax4dsUxGmmbA",
                   "https://encrypted-tbn2.google.com/images?q=tbn:ANd9GcTGVyjyj76ppSFsXTF5xjiWLw77oR7d9fxmVkkaj4dhsBWQioRz"];

    Dinos.insert({pix:dinoPix[0], div:"11"});
    Dinos.insert({pix:dinoPix[1], div:"22"});
    Dinos.insert({pix:dinoPix[2], div:"31"});
    Dinos.insert({pix:dinoPix[3], div:"44"});
    }
  });
}

// Set up a collection to contain player information. On the server,
// it is backed by a MongoDB collection named "dinos."
if(Meteor.is_client){
    Template.dinostemp.dinos = function(){
        return Dinos.find();
    };
}
最佳回答

You need {{/each}} to close the loop, not {{/dinos}}.

Error handling around malformed templates is still a work in progress.

问题回答

暂无回答




相关问题
Problems to run examples in Meteor

I m testing Meteor examples and this is what I see when I run meteor in todos examples: Unexpected mongo exit code 100. Restarting. Unexpected mongo exit code 100. Restarting. Unexpected mongo exit ...

Handlebars Exception

Any hints what the following exception might be about? Running on: http://localhost:3000/ No dependency info in bundle. Filesystem monitoring disabled. Errors prevented startup: Exception while ...

How easy to call external Web APIs in Meteor?

Does (or will) Meteor provide a library to handle external Web API calls? E.g. to build a Meteor app that integrates with Facebook Graph API or Google Spreadsheet API.

Meteor - Using collection on client startup

Why this code shows "0"? Shouldn t it return "1"? Messages = new Meteor.Collection("messages"); if (Meteor.is_client) { Meteor.startup(function () { alert(Messages.find().count()); ...

热门标签