145
rated 0 times
[
151]
[
6]
/ answers: 1 / hits: 28788
/ 12 Years ago, sat, april 28, 2012, 12:00:00
Is there any better ways to populate Jade based select fields, I am currently using this example. Is there any better ways to not ruin the template code?
the item value is 'day' example.
select
repeation = [ 'no-repeat', 'day', 'week', 'month']
for item in repeation
if job.repeat == item
option(selected=true) #{item}
else
option #{item}
Also what about displaying multiple selections, when the item is array of ['day', 'week']?
// Edit small possible solution for multiple element
enginges = [ 'google', 'bing', 'yahoo', 'duckduckgo']
for engine in enginges
option(selected=job.sources.indexOf(engine) != -1) #{engine}
More From » node.js