Displaying other user's email address in Meteor.js
javascript, meteor, mongodb
Solution
{{#each users}}
<h2>Email: {{emails.[0].address}}</h2>
{{/each}}
Don't call `users` once you're inside your `{{#each users}}` block .
Problem
Trying to display a view that shows all registered users of the app along with their email addresses. I'm using this pub/sub to pass all user data to the client instead of just the current users data. ``` Meteor.publish("allUsers", function () { return Meteor.users.find(); }); Meteor.subscribe('allUsers'); ``` Here is the for each loop in my template that is supposed to display their emails: ``` <template name="daysOverview"> <div class="container-fluid"> <div class="row"> {{#each users}} <h2>Email: {{users.emails.[0].address}}</h2> {{/each}} ``` Here is the javascript that is supposed to loop over all of the current registered users and feed their data to the helper. ``` Template.daysOverview.helpers({ users: function(){ var user = Meteor.users.find(); return user; }, }); ``` The helper correctly loops over the number of current users of the application (eg. if there are 3 users currently registered it will display 3 instances of "Email: " on the template). The problem is that I can't find a way to access the email address of each user and display that next to the corresponding "Email: ". I tested accessing a simpler field like "_id" unsuccessfully as well. I've also tried numerous different combinations of {{users.address}}, {{users[0].address}} to access the email with no luck.