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