Saturday, 27 May 2017

Jade: Cannot read property 'length' of undefined

I have a issue with the jade iteration. I want iterate sequelize query results on my jade page.

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

command prompt

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

Where i wrong?



via Gig90

No comments:

Post a Comment