玉:无法读取属性'长度'未定义的

时间:2017-05-27 15:36:08

标签: node.js express iteration pug sequelize.js

我对jade迭代有一个问题。 我想在我的玉页上迭代sequelize查询结果。

index.js

router.get('/new/:name', function(req, res) {
models.Event
    .findAll({attributes: ['incoming', 'event'], raw: true})
    .then(function (items) {
        // var results = items;
        console.log('FIND ALL EVENT AND INCOMING', items);
        res.render('templates/new/' + req.params.name, {eventList: items});
        // res.json(results);
    });
});

event.jade

ul
    each event in eventList // this is a test
        li!= event.event

命令提示符

TypeError: C:\Users\FORFIRM\Desktop\promos\views\templates\new\event.jade:31
29|             span.title Inserimento records tramite form
30|             ul
31|                 each list in eventList
32|                     each item in list
33|                         li #{item}
34|             .margin
Cannot read property 'length' of undefined

哪里错了?

0 个答案:

没有答案