私はuser
ヘルパーにアクセスし、ユーザーが自身のプロフィールを訪問しているかどうかを伝えるために、現在のユーザー_id
とその_id
を比較することができ、コレクションにヘルパーを追加したい流星、別のヘルパーからヘルパーにアクセスするには?
Template.user_profile.helpers({
user:function() {
return Meteor.users.find({'profile.front_name':Session.get('slug')}).fetch()[0];
}
});
のようなヘルパーを持っています。 私はかなり醜いものを使用しています:
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