帮助在jade express中显示变量 [英] help with displaying a variable in jade express
本文介绍了帮助在jade express中显示变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试使用res渲染加载一些变量:
I'm trying to load some variables with res render like that:
res.render('blog_edit', {title: 'edit your blog', posts: "something"});
虽然标题加载精细帖子总是显示为未定义...
这里有一些我试过的方式...
though title loads fine post always appears as undefined... here are some of the ways I tried...
=posts
#{posts}
和javascript变量
and as a javascript variable
script
document.write(posts)
它们都没有工作......你能帮忙吗?
提前感谢
none of them is working... can you please help? thanks in advance
推荐答案
尝试
res.render('blog_edit', {locals:{title: 'edit your blog', posts: "something"}});
#{locals.foo}
这篇关于帮助在jade express中显示变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文