Reputation: 9296
I want to set input value in my user profile to its db values if they are exists. I tried to use parameter passing in jade for this but I got the following error:
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
but when I render this templat I send it email as locals
res.redirect('/profile',{locals :{email:"profile.email"}});
I tried also to set input value to !{email} and #{email} but nothing works. any help?
Thanks, Feras
Upvotes: 1
Views: 5265
Reputation: 18177
I found that I had to wrap my variables in single quotes or else I got a unexpected token error:
input.input(value='#{email}')
Upvotes: 3
Reputation: 23663
You need to use #{ }
to access variables
input.input(id='email',type='text',value=#{email},name='email')
Upvotes: -2
Reputation: 261
res.redirect? res.render you mean? also you dont need locals:{}, just res.render('profile', { email: 'foo' })
Upvotes: 4