Reputation: 182
I'm new in meteor templates and trying to render emails from the next user objects with emails array:
{
"_id" : "8ngggLthJ6NRKJRfG",
"emails" : [
{
"address" : "[email protected]",
"verified" : false
}
]
}
Template helper:
Template.user.helpers({
users() {
return Meteor.users.find({}, { sort: { createdAt: -1 } }).fetch();
},
});
Template:
<template name="chats">
<ul>
{{#each users}}
{{> user}}
{{/each}}
</ul>
</template>
<template name="user">
<li>{{emails[0].address}}</li>
</template>
but I get error: "Error: Can't call non-function: [object Object]"
How can I fix it? Thanks in advance.
Upvotes: 0
Views: 92