Can Meteor Templates access Session variables directly?

后端 未结 6 1936
误落风尘
误落风尘 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

    You could add a isCurrentUserTemplate and include this in your other templates with

    {{> isCurrentUserTemplate}}
    

提交回复
热议问题