I am new to using jade and have this simple script:
extends layout
block page
- var menu = 'events'
block content
div event
each item in events
| Event name: #{item.name} Venue: #{item.venue} Drink Price Score: #{item.drink_prices}
Which I expect to output as:
Event name: example Venue: The ex. Drink Price Score: 7
With some header and footer content above and below.
However the following is output:
When I check the Chrome Inspector the code is put as a string between 'pre' tags.
Why is this happening and how do I get this to render normally? Thanks!
EDIT SOLUTION
The error was occuring in my controller code event.js
exports.list = function(req, res, next) {
req.models.Event.list(function(error, events) {
if (error) return next(error);
// res.send({events:events}); <-- offending line
res.render('event', { events: events } );
});
};
答案 0 :(得分:1)