[英]What is wrong with my simple meteor code
When I run it, nothing displays in the browser. 当我运行它时,浏览器中没有任何内容。 HTML:
HTML:
<head>
<title>projectsiddharth</title>
</head>
<body>
<h1>Hello from india!</h1>
<div class="java">{{> timetemplate}}</div>
<template name="timetemplate">
<p>The time is now {{time}}</p>
</template>
</body>
JS: JS:
if (Meteor.isClient) {
var data = {time: new Date()};
Template.timetemplate.helpers(data);
}
if (Meteor.isServer) {
}
Im new to meteor pls bear with me. 我是流星的新手,请耐心等待。 This code is for displaying the time currently.
此代码用于显示当前时间。 Help appreciated, thanks
帮助表示感谢,谢谢
Try by seperating your template from your body html. 尝试从您的身体html分离您的模板。
<head>
<title>projectsiddharth</title>
</head>
<body>
<h1>Hello from india!</h1>
<div class="java">{{> timetemplate}}</div>
</body>
<template name="timetemplate">
<p>The time is now {{time}}</p>
</template>
You are defining the Helpers the wrong way. 你正在以错误的方式定义助手。 Try:
尝试:
if (Meteor.isClient) {
Template.timetemplate.helpers({
time: function(){
return new Date();
};
});
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.