【发布时间】:2012-06-28 10:10:02
【问题描述】:
此代码应显示文档字段 first_name 和 last_name,但它会生成“未捕获的错误:未知帮助程序 'first_name'”错误:
# In Template.
{{#with doc}}
<p>{{first_name}} {{last_name}}</p>
{{/with}}
# Template 'doc' property.
_.extend Template.doc,
doc: -> Docs.findOne {_id: Session.get 'doc_id'}
如果我将 #with 和 findOne() 替换为 #each 和 find() 效果很好:
# In Template.
{{#each doc}}
<p>{{first_name}} {{last_name}}</p>
{{/each}}
# Template 'doc' property.
_.extend Template.doc,
doc: -> Docs.find {_id: Session.get 'doc_id'}
这篇文章建议#with 应该可以工作Turn a meteor method returning a single object into a context for handlebar
我正在使用 Meteor 0.3.7
【问题讨论】:
标签: meteor coffeescript spacebars