My sidebar needs to load the names and paths out of the the nodes collection. my publication.js
Meteor.publish('nodes', function(){
return Nodes.find();
}); my nodes_find.js in the server file with the publication.js file
if(Nodes.find().count() === 0){
Nodes.insert({
name: "Example Node",
path: "ExampleNode"
});
Nodes.insert({
name: "Node 2",
path: "ExampleNode"
});
Nodes.insert({
name: "Node 3",
path: "ExampleNode"
});
} the Html block for the nodes and paths to show up on
<template name="sidebar">
<ul class="sidebar-nav" id="sidebar" role="navigation">
<div class="nodes">
{{#each nodes}}
<li>
<a href="{{path}}">
{{name}}
</a>
</li>
{{/each}}
</div>
</ul>
and finally the sidebar.js file
Template.sidebar.helpers({
nodes: function(){
return Nodes.find();
}
});
although all I get is 4 paper thin tabs with no names and no paths. I have gone over the Discover Meteor book and done the practice and have seen how they use it and looked on many forumns and have seen this exact code work. Is there something I am missing?
I think you have forgotten to subscribe your publication. Or if your
autopublish
is installed then you don't need to subscribe. And please check your client console if your data is really getting passed in the client or not.