मैं की तरहउल्का, किसी अन्य सहायक से एक सहायक के लिए कैसे पहुंचे?
Template.user_profile.helpers({
user:function() {
return Meteor.users.find({'profile.front_name':Session.get('slug')}).fetch()[0];
}
});
एक सहायक मैं संग्रह जो वर्तमान उपयोगकर्ता _id
साथ user
सहायक पहुंच पा रहे थे और तुलना करें अपनी _id
करने के लिए एक सहायक को जोड़ने के लिए, बता उपयोगकर्ता अपने स्वयं के प्रोफ़ाइल पर जाकर है कि क्या करना चाहते हैं। मैं कुछ बहुत बदसूरत उपयोग कर रहा हूँ:
Template.user_profile._tmpl_data.helpers.user()
अंतिम कोड:
Template.user_profile.helpers({
user:function() {
return Meteor.users.find({'profile.front_name':Session.get('userId')}).fetch()[0];
},
isCurrentUser: function() {
return Template.user_profile._tmpl_data.helpers.user()._id === Meteor.userId();
}
});
एक और सहायक का उपयोग करने के लिए किसी भी बेहतर तरीका है?
मैं प्रोफ़ाइल उपयोगकर्ता का दौरा कर रहा है अपनी ही है कि क्या जांच करने के लिए चाहते हैं। –
जो प्रश्न नहीं थे ... – SsouLlesS