[solved] Call helper from another helper, event and tpl callbacks

Is there a way to call helper from browser console?
There is autocompletion in Chrome console for Template.mytpl.helpers… but what to do next?

Helpers can be run only within a template instance (because they depend on the current data context). If you want to reuse the helpers you can declare them outside of Template.helpers call, for example:

var postHelpers = {
  title: function () {
    return Posts.findOne().title;
  }
};

Template.post.helpers(postHelpers);
1 Like

Actually you can hack it like this:

Template.addPost.__helpers.get('helperName').call()
4 Likes

If you need to access global helper, use:

Blaze._globalHelpers['helper']()
2 Likes

In the hindsight - all of this trickery is unnecessary with @manuel’s viewmodel

1 Like