Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

Converting EJS code in Jade

Converting EJS code in Jade

Problem

At the moment i'm using EJS template Engine but I need to convert it in Jade, could someone help me with this conversion?

Problem courtesy of: Dail

Solution

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
Solution courtesy of: Brad Harris

Discussion

View additional discussion.



This post first appeared on Node.js Recipes, please read the originial post: here

Share the post

Converting EJS code in Jade

×

Subscribe to Node.js Recipes

Get updates delivered right to your inbox!

Thank you for your subscription

×