我对backbone.js 很陌生,我正在尝试显示嵌套数组值,但我显示的只是ojbect 对象。
我知道数据已返回,因为我可以在响应中看到它(见下文)。
<span class="lbl"> <%= title %> <%= status %> <%= questions[0] %></span>
以上显示Programming Draft[object Object]
我也试过
<span class="lbl"> <%= title %> <%= status %> <%= questions.question %> </span>
但它返回编程草案
回复
{
"title": "Programming",
"category": "IT",
"_id": "5269344db00754f370000012",
"__v": 0,
"status": "Draft",
"questions": [
{
"_id": "5269344db00754f37000000e",
"difficulty_level": "Medium",
"question_type": "Pick One",
"question": "How long is a piece of string?",
"tags": [
"General"
],
"answer_options": [
{
"a_option": "Way too long!",
"answer": "False"
},
{
"a_option": "Not long enough",
"answer": "False"
},
{
"a_option": "A Frayed Knot",
"answer": "True"
}
],
"allow_dont_knows": false,
"status": "Draft",
"requires_approval": false
},
{
"_id": "5269344db00754f37000000f",
"difficulty_level": "Medium",
"question_type": "Pick One",
"question": "What is the nearest planet to earth?",
"tags": [
"Science",
"Space"
],
"answer_options": [
{
"a_option": "Mars",
"answer": "False"
},
{
"a_option": "Venus",
"answer": "True"
},
{
"a_option": "Jupiter",
"answer": "False"
},
{
"a_option": "Neptune",
"answer": "False"
},
{
"a_option": "Saturn",
"answer": "False"
}
],
"allow_dont_knows": false,
"status": "Draft",
"requires_approval": false
},
{
"_id": "5269344db00754f370000010",
"difficulty_level": "Medium",
"question_type": "Pick One",
"question": "What is the largest planet?",
"tags": [
"Science",
"Space"
],
"answer_options": [
{
"a_option": "Mars",
"answer": "False"
},
{
"a_option": "Venus",
"answer": "False"
},
{
"a_option": "Jupiter",
"answer": "True"
},
{
"a_option": "Neptune",
"answer": "False"
},
{
"a_option": "Saturn",
"answer": "False"
}
],
"allow_dont_knows": false,
"status": "Draft",
"requires_approval": false
}
],
"requires_approval": false
}
]