コレクションに json オブジェクトがあり、ページに表示する必要があります。これが私がやったことhelpers template
です: コレクションから json オブジェクトを取得するという点で、最初に then を呼び出します: 私は coffeescirpt と jade-handlebars を使用しています。
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]
。question1,question2 を見るには、次のことを行う必要があります。
template(name="hello")
.test {{QuestionData.question1}}, {{QuestionData.question2}}
何もせずにすべての質問を動的に表示するにはどうすればよいですか{{QuestionData.question1}}
...
前もって感謝します !!!