Meteor, how to access to a helper from another helper?

前端 未结 5 1864
无人共我
无人共我 2020-12-25 09:52

I have a helper like

Template.user_profile.helpers({
  user:function() {
     return Meteor.users.find({\'profile.front_name\':Session.get(\'slug\')}).fetch(         


        
5条回答
  •  情书的邮戳
    2020-12-25 10:41

    maybe this would work for you:

      //js
    Template.foo.helpers({ bar: function() {
     return this.userId == Meteor.userId(); },
     domain: function() {
     var a = document.createElement('a'); a.href = this.url;
     return a.hostname;
     } });
    
     ownsDocument = function(userId, doc) { return doc && doc.userId === userId;}
    
     Posts = new Meteor.Collection('posts');
     Posts.allow({
     update: ownsDocument, remove: ownsDocument
     });
    
      //html
    {{#if bar}}Edit{{/if}}
    

提交回复
热议问题