help with displaying a variable in jade express

前端 未结 3 1424
太阳男子
太阳男子 2020-12-17 14:54

I\'m trying to load some variables with res render like that:

res.render(\'blog_edit\', {title: \'edit your blog\', posts: \"something\"});

3条回答
  •  死守一世寂寞
    2020-12-17 15:14

    I'm using the latest versions today ("express": "4.11.2", "jade": "1.9.2") and this is the syntax that works for me:

    res.render('blog_edit', {title: 'edit your blog', posts: "something"});
    

    In template:

    #{locals.posts}
    

    or

    #{posts}
    

提交回复
热议问题