0

I am very, very new to Meteor. I am using Iron Router to create a fairly simply Blog site. What I'd like to do is have functions added to my Blogs collection entities that allows me to return a "preview" of a given post. Using the 3rd answer to this SO posting, I added something like this:

Blogs = new Meteor.Collection('blogs', {
    transform: function(entry) {
        // Add any custom methods to the Blog
        entry.getBodyMinimal = function(length) {
            if (length == null) {
                length = 100;
            };
            return this.body.substr(1,length);
        };
        return entry;
    }
});

However, I have no clue how to call it in the template as part of my {{#each blogsList}} loop. I tried {{{ this.getBodyMinimal(10) }}} and {{{.getBodyMinimal(10) }}} and neither worked. Is this even possible?

Community
  • 1
  • 1
CodeChimp
  • 8,016
  • 5
  • 41
  • 79

1 Answers1

1

You pass args by separating them with spaces.

{{{ getBodyMinimal 10 }}}

Spacebars documentation

Neil
  • 2,137
  • 16
  • 24