Meteor accounts-list -


i want display registered accounts in meteor app. published , subscibed meteor.users collection , build template show email-addresses. problem don't understand how should navigate data.

<template name="contacts"> <br> <ul class="list-group">     {{#each users}}       <li class="list-group-item">         <span class="badge">14</span>         {{emails}}       </li>     {{/each}} </ul> </template> 

{{emails}} array json-objects , don't know how handle "address" field displayed.

this js:

template.kontakte.users = function (){    return meteor.users.find(); } 

first create subtemplate, looks better:

<template name="contacts">    <ul class="list-group">     {{#each users}}       {{> user}}     {{/each}}   </ul> </template>   <template name="user">   <li class="list-group-item">     <span class="badge">14</span>     {{email}}   </li> </template> 

in template user userobject available via pointer. email can shown helper functions.

template.user.helpers({   email: function() {     return this.emails[0].address;   } }); 

note, shows first email in array.


Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -