Reputation: 4608
At the moment i'm using EJS template Engine but I need to convert it in Jade, could someone help me with this conversion?
<option<%- (page['frmContact']['subject'] == 'Informazioni generiche') ? ' selected="selected"' : '' %>>Informazioni generiche</option>
<option<%- (page['frmContact']['subject'] == 'Partnership') ? ' selected="selected"' : '' %>>Partnership</option>
<option<%- (page['frmContact']['subject'] == 'Corsi') ? ' selected="selected"' : '' %>>Corsi</option>
Upvotes: 0
Views: 1259
Reputation: 1520
This is the closest I came up with, but you end up with an empty selected property if the conditional is false:
option(selected=(page.frmContact.subject == 'Informazioni generiche' ? 'selected' : '')) Informazioni generiche
option(selected=(page.frmContact.subject == 'Partnership' ? 'selected' : '')) Partnership
option(selected=(page.frmContact.subject == 'Corsi' ? 'selected' : '')) Corsi
I'm not sure if this compiles, but this would be how you would not show the selected attribute at all if the condition was false:
option((page.frmContact.subject == 'Informazioni generiche' ? selected="selected" : '')) Informazioni generiche
Upvotes: 2