0
在main.js中Template.main未定义,但我不明白为什么。这两个文件都在/ client目录中。无法读取未定义的属性'助手' - 模板名为
我敢肯定我错过了一些明显的东西。
main.html中
<head>
<title>QuizAero</title>
</head>
<body>
<div class="container">
<header class="navbar navbar-default" role="navigation">
<div class="navbar-header">
<a class="navbar-brand" href="/">QuizAero Admin Dashboard</a>
</div>
</header>
<template name="main">
{{#each categories}}
<div id="mainSection" class="col-lg-3 pull-left">
{{categories}}
</div>
{{/each}}
</template>
</div>
</body>
main.js
if (Meteor.isClient) {
var categoryNames = [
{
title: 'Air Law'
},
{
title: 'Meteorology'
},
{
title: 'Navigation'
}];
Template.main.helpers({
categories: categoryNames
});
}
if (Meteor.isServer) {
Meteor.startup(function() {
// code to run on server at startup
});
}
感谢您的帮助。
谢谢!非常简洁的答案。 – Lee