Display json object dynamically
I have a json object in collection which I need to show it on the page.
Here is what I did: I first call the helpers template then in that I fetch
the json object from the collection: I am using coffeescirpt and
jade-handlebars, here goes my code in coffeescript:
Template.test.helpers
test: ->
test = Question.find().fetch();
test
In the console when I do Question.find().fetch() the following thing occurs:
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"
Now in the jade when I call the template by:
template(name="hello")
.test {{QuestionData}}
I can see only the [object] [object]. To see the question1,question2 I
have to do the following:
template(name="hello")
.test
How can I dynamically show all the questions without doing
{{QuestionData.question1}} ...
Thank You in advance !!!
No comments:
Post a Comment