在jade上迭代对象数组

在jade上迭代对象数组

问题描述:

请帮我迭代下面的对象数组。我能看到在控制台对象的数组,但在玉我不能重复它在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(“指数”,{AAA:JSON.stringify(结果)}) ;

玉:

extends layout 

    block content 

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

    each value in bbb 
    p= value.title 
+0

目前尚不清楚这个问题正在解决哪个问题。 –

+0

1st block是我试图迭代的对象数组。第二块是我尝试迭代的玉器。 –

我想你只需要设置value.title这样的:

each value in bbb 
    p !{value.title} 

希望它能帮助。

+0

它不工作... –

+0

C:\ heroku \ checkRepository \ views \ index.jade:14 12 | 13 | > 14 |每个值在bbb 15 |中p!{value.title} 16 | 17 |无法读取未定义的属性“长度” TypeError:C:\ heroku \ checkRepository \ views \ index.jade:14 12 | \t 13 | \t > 14 | \t bbb中的每个值 15 | \t \t p!{value.title} 16 | 17 | 无法读取未定义的属性“长度” –