我想将用户配置文件中的输入值设置为其数据库值(如果存在)。我尝试使用 jade 中的参数传递来实现此目的,但出现以下错误:
referenceError: /Users/Feras/Sites/wowito/views/profile.jade:13
11| fieldset(data-role='controlgroup')
12| label.label(for='email') EMail
> 13| input.input(id='email',type='text',value=email,name='email')
14| label.label(for='firstName') First Name
15| input.input(id='firstName',type='text',value='',name='firstName')
16| label.label(for='lastName') Last Name
email is not defined
但是当我渲染此模板时,我会以本地人的身份向其发送电子邮件
res.redirect('/profile',{locals :{email:"profile.email"}});
我还尝试将输入值设置为 !{email} 和 #{email} 但没有任何效果。有什么帮助吗?
谢谢, 费拉斯
最佳答案
res.重定向? res.render 你的意思是?您也不需要本地变量:{},只需 res.render('profile', { email: 'foo' })
关于node.js - 使用 Jade 模板局部变量设置输入值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10375521/