0
如何將第一個名稱對象渲染到屏幕上?我在這樣做時遇到了麻煩。 我沒有使用流星提供的帳戶軟件包。請記住,顯示的js代碼是註冊和的模板的名稱,名爲dashboard的模板是以下所示的html。(如果讓任何意義。)對象不渲染
Template.registrationForm.events({
'click input[name=submitBtn]' : function(e) {
e.preventDefault();
var userName = username.value;
var passWord = password.value;
var firstName = firstname.value;
var lastName = lastname.value;
var emailAddress = emailaddress.value;
if (userName == "") {
console.log("Null");
}
if (passWord == "") {
console.log("Null");
}
if (firstName == "") {
console.log("Null");
}
if (lastName == "") {
console.log("Null");
}
if (emailAddress == "") {
console.log("Null");
}
// insert user's info into the database.
UsersList.insert({
uname: userName,
pword: passWord,
fname: firstName,
lname: lastName,
eaddress: emailAddress
});
Router.go('/dashboard');
// console log msg for debugging purposes.
console.log("submitBtn has been clicked.");
}
});
<template name="dashboard">
<!--{{#if currentUser}}-->
<nav>
<ul>
<li>Videos |</li>
<li>Games |</li>
<li><a href="/dashboard">Dashboard</a> |</li>
<li><a href="/blog">Blog</a>
</li>
<!--<li><a>{{currentUser.profile.uname}}</a></li>-->
</ul>
</nav>
<!--{{/if}}-->
<body>
Hello {{users.fname}}!
</body>
</template>
_」您不會顯示模板儀表板的JavaScript,這將決定它是否呈現。「_ 有什麼辦法可以將它留在registrationForm事件中並將其呈現給儀表板模板?我還沒有爲儀表板創建js文件,感謝TIC的幫助! – codenewb