I'm using Jade templates in an edit view where I edit a user's details, and a dynamically generated radio button like so (comes from my mongodb):
li Role:
br
label Subscriber
input(type="radio", name="user[role]", val="subscriber")
br
label Admin
input(type="radio", name="user[role]", val="admin")
br
label Super Admin
input(type="radio", name="user[role]", val="superadmin")
How do I set one to checked dynamically?
So if in my db, my role is subscriber
, how do I check for that? "Normally", I would do a if(user.role == 'subscriber'){'checked'}
and so on for all of the different values.
Where/how does that logic go into this bit of Jade?