我想以表格形式顯示所有用戶信息,作爲管理頁面的一部分。我用流星賬戶的ui軟件包也是一樣。在流星帳戶中迭代用戶帳戶UI
的HTML代碼是:
{{#each userList}}
<tbody>
<tr>
<th scope="row">*</th>
<td>{{infofullname}}</td>
<td>{{infosurname}}</td>
<td>{{infoemail}}</td>
</tr>
</tbody>
{{/each}}
的問題是越來越顯示當前用戶的信息,而不是所有的登記用戶。迭代確實發生,但對於當前登錄的用戶。此外,電子郵件地址未顯示。
助手代碼:
Template.students.helpers({
userList: function(){
return Meteor.users.find({});
},
infofullname: function(){
return Meteor.user().profile.fullname;
},
infosurname: function(){
return Meteor.user().profile.surname;
},
infoemails: function(){
return Meteor.user().emails.[0].address;
}
});
進出口面臨以下問題: 1)中,無法顯示的電子郵件地址。 2)所有用戶的信息沒有得到顯示。
謝謝。
你能告訴你的出版物?這就是將數據傳遞給客戶端以顯示的。 –
@MichelFloyd我還沒有創建出版物。出版物如何在這裏有用?如何爲這種情況下定義出版物?我對流星很陌生。 –