迭代jade-objects对象

时间:2017-09-25 12:58:38

标签: node.js pug

请帮我迭代以下对象数组。我能在控制台中看到对象数组,但我无法在jade中迭代它

[{title: "Stamp. The Hobbit", description: "Stamp. <b>The Hobbit</b>. I know 
it was on Friday …n the day when there was not a lot of creativity.", 
originalLink: null, summary: null, date: "2017-09-25T06:42:50.000Z"}
{title: "Fall/winter Tolkien/LOTR events: your &#39;go-to&#39; list", 
description: "Audiences will thrill to the music from his legend…bbit</b> 
with scores from his films: The&nbsp;...", originalLink: null, summary: 
null, date: "2017-09-25T05:26:15.000Z"},
{title: "Watch what happens when Darth Vader swaps galaxy far, far away ... 
for Middle Earth", description: "The narrative of Middle Earth: Shadow of 
War is ba…nts of <b>The Hobbit</b> and The Lord of&nbsp;...", originalLink: 
null, summary: null, date: "2017-09-25T03:56:15.000Z"}
{title: "The hobbit sword", description: "Posted by alex in kids / baby 
stuff, toys in Munster, Cork. 24 September 2017...210966215.", originalLink: 
null, summary: null, date: "2017-09-24T19:30:12.000Z"}
{title: "The hobbit as high fantasy essay", description: "Im science teacher 
is stupid hes making me write a… like r u serious. Problems of urbanization 
essay", originalLink: null, summary: null, date: "2017-09-24T19:26:02.000Z"}
{title: "Lego The Hobbit Bagend Bundle", description: "Lego <b>The 
Hobbit</b> Bagend Bundle, Used Lego &a…, Dublin, Ireland for 130.00 euros on 
Adverts.ie.", originalLink: null, summary: null, date: "2017-09-
24T10:42:38.000Z"}]

服务器代码:         res.render('index',{aaa:JSON.stringify(result)});

玉:

    extends layout

    block content

    script.
    console.log("hi");
    var bbb = !{aaa}
    console.log(bbb)

    each value in bbb
     p= value.title

1 个答案:

答案 0 :(得分:0)

我认为你必须像这样设置value.title:

 each value in bbb
     p !{value.title}

希望它有所帮助。