【发布时间】:2013-09-13 21:40:34
【问题描述】:
我在集合中有一个 json 对象,我需要在页面上显示它。
这是我所做的:
我首先调用 helpers template 然后从集合中获取 json 对象:
我正在使用 coffeescirpt 和玉手把,这是我在 coffeescript 中的代码:
Template.test.helpers
test: ->
test = Question.find().fetch();
test
当我在控制台中执行Question.find().fetch() 时,会发生以下事情:
QuestionData: Object
question1: "How many kids do I have ?"
question2: "when will i die ?"
question3: "how many wife do i have ?"
question4: "test"
__proto__: Object
_id: "w9mGrv7LYNJpQyCgL"
userid: "ntBgqed5MWDQWY4xt"
specialNote: "Rohan ale"
现在在翡翠中当我通过以下方式调用模板时:
template(name="hello")
.test {{QuestionData}}
我只能看到[object] [object]。要查看问题 1、问题 2,我必须执行以下操作:
template(name="hello")
.test {{QuestionData.question1}}, {{QuestionData.question2}}
如何在不做{{QuestionData.question1}}的情况下动态显示所有问题...
提前谢谢你!!!
【问题讨论】:
标签: javascript json coffeescript meteor