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).
前者工作(Template.hello.loggedin在控制台中打印出函数,添加括号返回的东西),后者没有(给出undefined)。
I thought these were equivalent??
我以为这些是等价的?
1 个解决方案
#1
2
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.
它们是等效的,除非你找到了。 github上存在一个未解决的问题:https://github.com/meteor/meteor/issues/886。
If you want to call Template.hello.loggedin()
use the former.
如果要调用Template.hello.loggedin(),请使用前者。
#1
2
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.
它们是等效的,除非你找到了。 github上存在一个未解决的问题:https://github.com/meteor/meteor/issues/886。
If you want to call Template.hello.loggedin()
use the former.
如果要调用Template.hello.loggedin(),请使用前者。