Can Meteor Templates access Session variables directly?

后端 未结 6 1935
误落风尘
误落风尘 2020-12-08 04:44

In my Meteor app I find myself writing a lot of things like:

Templates.myTemplate1.isCurrentUser = function() {
  return Session.get(\"isCurrentUser\");
};

         


        
6条回答
  •  猫巷女王i
    2020-12-08 05:23

    Actually now you can just use {{#if currentUser}}

    It's a global included from the accounts/auth package..

    http://docs.meteor.com/#template_currentuser

提交回复
热议问题