meteor.js Template helpers as variable vs key+value

261 views Asked by At
Template.hello.loggedin = function() { return something }

vs.

Template.hello.helpers({
  'loggedin': function () { return something }
})

The former works (Template.hello.loggedin prints out the function in the console, adding parenthesis returns the something), the latter doesn't (gives undefined).

I thought these were equivalent??

1

There are 1 answers

1
Tarang On BEST ANSWER

They are equivalent except in the case you found. There is an open issue on github about this: https://github.com/meteor/meteor/issues/886.

If you want to call Template.hello.loggedin() use the former.