Javascript 为什么现在会显示此模板?
我在Meteor.js应用程序上显示模板时遇到问题。这是网站列表。因为某种原因,它没有显示出来,也许你可以帮我 我正在尝试显示网站MongoDB集合中的网站列表 HTML代码:Javascript 为什么现在会显示此模板?,javascript,templates,meteor,iron-router,Javascript,Templates,Meteor,Iron Router,我在Meteor.js应用程序上显示模板时遇到问题。这是网站列表。因为某种原因,它没有显示出来,也许你可以帮我 我正在尝试显示网站MongoDB集合中的网站列表 HTML代码: <!-- master layout template --> <template name="ApplicationLayout"> {{> yield "navbar"}} {{> yield "main"}} </template> <!-- /
<!-- master layout template -->
<template name="ApplicationLayout">
{{> yield "navbar"}}
{{> yield "main"}}
</template>
<!-- / master layout template -->
<!-- WELCOME -->
<template name="welcome">
<div class="container">
<div class="jumbotron">
<h1>Welcome to Site Ace, {{username}}!</h1>
<a href="/websites" class="btn btn-info">Enter</a>
</div>
</div>
</template>
<!-- / WELCOME-->
<!-- NAVBAR - you will be putting the login functions here -->
<template name="navbar">
<nav class="navbar navbar-default">
<div class="container-fluid">
<div class="navbar-header">
<a class="navbar-brand" href="/">
Site Ace
</a>
</div>
<ul class="nav navbar-nav login">
<li>
{{> loginButtons}}
</li>
</ul>
</div>
</nav>
</template>
<template name="websites">
<div class="container">
{{> website_form}}
{{> website_list}}
</div>
</template>
<!-- / NAVBAR -->
<!-- WEBSITE FORM -->
<template name="website_form">
{{#if currentUser}}
<a class="btn btn-default js-toggle-website-form" href="#">
<span class="glyphicon glyphicon-plus" aria-hidden="true"></span> Add a Website
</a>
{{/if}}
<div id="website_form" class="hidden_div">
<form class="js-save-website-form">
<div class="form-group">
<label for="url">Site address</label>
<input type="text" class="form-control" id="url" placeholder="http://blablabla.org">
</div>
<div class="form-group">
<label for="title">Title</label>
<input type="text" class="form-control" id="title" placeholder="Mysite">
</div>
<div class="form-group">
<label for="description">Description</label>
<input type="text" class="form-control" id="description" placeholder="I found this site really useful for ...">
</div>
<button type="submit" class="btn btn-default js-">Submit</button>
</form>
</div>
</template>
<!-- / WEBSITE FORM -->
<!-- WEBSITE LIST -->
<template name="website_list">
<ol>
{{#each websites}}
{{>website_item}}
{{/each}}
</ol>
</template>
<!-- / WEBSITE LIST -->
<!-- WEBSITE ITEM -->
<template name="website_item">
<li>
<a href="{{url}}">{{title}}</a>
<p>
{{description}}
</p>
<p>
<a href="/details/{{_id}}" class="btn btn-info">
Details
</a>
<a href="#" class="btn btn-success js-upvote">
<span class="glyphicon glyphicon-arrow-up" aria-hidden="true"></span>
</a>
<a href="#" class="btn btn-danger js-downvote">
<span class="glyphicon glyphicon-arrow-down" aria-hidden="true"></span>
</a>
</p>
<!-- you will be putting your up and down vote buttons in here! -->
</li>
</template>
<!-- / WEBSITE ITEM -->
您忘记为
网站列表
模板实现帮助函数,该模板返回网站
集合的文档
例如:
Template.website_list.helpers({
websites: function() {
return Websites.find();
}
});
这里有一个。您忘记为
网站列表
模板实现帮助函数,该模板返回网站
集合的文档
例如:
Template.website_list.helpers({
websites: function() {
return Websites.find();
}
});
这是一个例子