基于集合的字段动态显示数据

时间:2016-02-03 01:49:01

标签: meteor meteor-blaze

因此,我收集了包含以下字段的文档(id,usera,userb,message)。 (文档名称室)现在我想根据登录用户命名一个房间。即如果我是用户,我想要显示userb,反之亦然。我有下面的代码,它似乎一直只输出userb。任何建议将不胜感激。

<template name="rooms">
<h4>Contacts:</h4>
<ul>
{{#each rooms}}
    {{> room}}
{{/each}}
</ul>

<template name="room">
<li style="cursor: pointer; {{roomstyle}}">
    {{#if useraIs}}
    {{userb}}
    {{/if}}
     </li>

  });

 Template.room.helpers({
useraIs: function(usera) {
    return this.usera==Meteor.userId();
  }

});

0 个答案:

没有答案