I want to render 'jade view' with data.
like below,
app.get('/', function(req, res){
res.render('alert', {msg: 'hi!'});
});
So, I wrote the jade code below: (alert.jade)
script.
alert(#{msg});
2)
script.
alert(=msg);
3)
script.
alert(msg);
But nothing works.
How can I render it?
Try this in your script. tag
script.
var msgStr = !{JSON.stringify(msg)};
alert(msgStr)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.