我正在玩有前途的流星框架并碰壁。在我的模板中插入{{#if something}}{{/if}}
任何地方都会导致呈现一个空页面。考虑这个模板:
<head>
<title>MUse - XUse on Meteor</title>
</head>
<body>
{{> menu}} {{> login }}
{{> hello}}
</body>
<template name="hello">
<div class="hello">
<h1>This is Xuse on Meteor a.k.a. <em>MUse</em></h1>
</div>
</template>
<template name="login">
<div class="login">
<label for="username">Login:</label>
<input type="text" id="username" value="" placeholder="Login"/>
<label>Password:</label>
<input type="password" id="password" value="" placeholder="Password"/>
<input type="button" id="signin" name="signin" value="Sign in" />
</div>
</template>
<template name="dashboard">
<div class="dashboard">
Hi, {{login_name}}.
</div>
</template>
<template name="menu">
<nav>
<a href="/#dashboard">Dashboard</a> |
<a href="/#logout">Log out</a> |
{{#if login_name}}
<a href="/#{{login_name}}">{{login_name}}</a>
{{/if}}
</nav>
</template>
以防万一coffeescript
代码:
if Meteor.is_client
Template.hello.greeting = -> "Welcome to muse."
Template.login.events =
'click #signin' : ->
console.log "You pressed the 'sign in' button" if console?
login_name = $('#username').val()
password = $('#password').val()
console.log "Credentials: #{login_name} -> #{password}" if console?
Template.menu.events =
'click a[href*="dashboard"]' : ->
console.log "Menu -> Dashboard invoked" if console?
'click a[href*="logout"]' : ->
console.log "Menu -> Log out invoked" if console?
if Meteor.is_server
Meteor.startup ->
time = new Date
console.log "#{time} Hi. This is server" if console?
仅此而已——仅此而已。删除{{#if...}}
序列会导致正确呈现,而将其留在原处或放置在任何有意义的地方都会呈现空白页面。有什么线索吗?
我确实尝试了 todos 示例,它在同一台机器上工作,所以这不是安装问题。顺便说一句,这台机器是一台装有 Ubuntu 12.04 的旧笔记本电脑 Asus A6Rp。