0
我有一個對象被從快遞後端傳遞是展示低於運行循環來遍歷對象的數組在玉模板
{
_id: 5452e afedac635961faff524,
__v: 0,
English: 'null',
Url: 'null',
Amount: '12999',
Status: 'Article Received',
OrderId: 'tok_14tUYy2Jju1nvjb4L3ZLSTRl',
Payment: 'Paid',
NoteToJourno: '',
EditorNote: '',
About: '',
Facts: ['[{"count":1,"fact":"dsaf","content":"sdaf"}]'],
KeyPoint: 'This sime;t',
Angle: 'Casual',
Embargo: 'dsf',
ProjectName: 'Anthony',
date: Fri Oct 31 2014 07: 20: 27 GMT + 0530(IST),
userEmail: '******[email protected]',
userName: 'raju'
}
下面是我的玉模板看起來
body
.container
table.table.table-bordered
thead
tr
th Username and Email
th
span
| #{data[0].userName}
span
| #{data[0].userEmail}
tbody
tr
td Project Name
td #{data[0].ProjectName}
tr
td Project Embargo
td #{data[0].Embargo}
tr
td Angle
td #{data[0].Angle}
tr
td Key Point
td #{data[0].KeyPoint}
tr
td
strong Facts
td
for fact in data[0].Facts
tr
td Fact fact.count
td fact.fact
tr
td About
td #{data[0].About}
tr
td Editor Note
td #{data[0].EditorNote}
tr
td Note to Journalist
td #{data[0].NoteToJourno}
tr
td Preffered style of English
td #{data[0].English}
tr
td
td
|#{data}
我的問題是我想迭代Facts數組並打印數組中的元素。正如你可以看到我已經使用了爲循環,犯規輸出的值,我也嘗試過使用
each fact in data[0].Facts
tr
td=fact.count
td=fact.fact
,但它不工作,以及,我要去哪裏錯了?
對不起,對於遲到的答覆,但非常感謝,結果是一個字符串,所以我解析我JSON和它的工作。 – Bazinga777 2014-11-04 05:42:02