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??
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With