1
からの眺めに私は、流星のユーザーアカウントの文書を次ていますリスト配列オブジェクトの値流星のユーザーコレクション
{
"_id":"aaaa",
"profile":{
"friendlist":[
{"userId":"bbbb"},
{"userId":"cccc"},
{"userId":"dddd"}
]
}
}
私はこのようになります。私の見解でfriendlist配列からのuserIdを反復処理したい:
Friends List: bbbb, cccc, dddd
HTMLは、私は次のように仮定になります
<template name="friendListCard">
Friends List:
{{#each searchFriendList}}
{{profile.friendlist.userId}},
{{/each}}
</template>
とfollowinのようなtemplate.helper g:
Template.friendListCard.helpers({
searchFriendList: function(){
Meteor.users.find({_id:Meteor.userId()})
},
});
私はこれを行うことはできません。どんな助け?
感謝。私はその文書をモデル化するあなたの提案に従った。注意するには、配列を使用するときは、{{this}}を使用して配列項目をビューに表示します。 – Edward
はい、テンプレートを変更する必要があります。 –