流星模板助手位置
Meteor template helper location
我的应用程序结构如下:
myapp/
myapp/client/index.html
myapp/client/lib/helpers.js
myapp/server...
里面helpers.js
我有:
Template.game.helpers({
game_id: function() {
return '12345';
}
});
里面index.html
我有:
<div>
Game: {{> game }}
<template name='game'>
{{game_id}}
</template>
</div>
我收到以下错误,页面显示完全空白:
Uncaught TypeError: Cannot read property 'helpers' of undefined
Uncaught Error: No such template: game
我在 Windows 上使用 Meteor,但我怀疑这个问题是 Windows 特有的。
模板需要在顶层定义(在任何其他 html 标签之外)。将 index.html
更改为如下所示:
<body>
Game: {{> game}}
</body>
<template name='game'>
{{game_id}}
</template>
我建议通过 tutorial on meteor.com。
我的应用程序结构如下:
myapp/
myapp/client/index.html
myapp/client/lib/helpers.js
myapp/server...
里面helpers.js
我有:
Template.game.helpers({
game_id: function() {
return '12345';
}
});
里面index.html
我有:
<div>
Game: {{> game }}
<template name='game'>
{{game_id}}
</template>
</div>
我收到以下错误,页面显示完全空白:
Uncaught TypeError: Cannot read property 'helpers' of undefined
Uncaught Error: No such template: game
我在 Windows 上使用 Meteor,但我怀疑这个问题是 Windows 特有的。
模板需要在顶层定义(在任何其他 html 标签之外)。将 index.html
更改为如下所示:
<body>
Game: {{> game}}
</body>
<template name='game'>
{{game_id}}
</template>
我建议通过 tutorial on meteor.com。