我想在nodejs中做几个渲染渲染错误我发生如下:
res.render ('header', {
title: 'demo'
});
res.render ('main', {
container: 'dataaa'
});
答案 0 :(得分:0)
您应该使用include代替
//- layout.jade
doctype html
html
include ./head.jade
body
include ./main.jade
然后
res.render ('layout', {
title: 'demo',
container: 'dataaa'
});
答案 1 :(得分:0)
the original idea is to obtain two collections to two files in jade
unoCollection var = db.get ( 'one');
unoCollection.findById (id, function (err, result) {
res.render ('header', {
name: result.name,
surname: result.surname,
});
});
unoCollection var = db.get ('two');
unoCollection.find ({}, function (err, result) {
res.render ('users', {
name: result.name,
surname: result.surname,
});
});
and jade
html
body
include header.jade
include usuarios.jade
It does not work this way there somehow?