Am using jade as express.js view engin, and I use Micro-Templating ; here is a problem i came across here is the template
script(id='form',type='text/html')
select(id='select_category',name='product_category')
option <%= option%>
to use the template
$(tmpl('form',{'option':'something'}))
now i have more than one option so this is what i did
i change the template
script(id='form',type='text/html')
select(id='select_category',name='product_category')
each val,key in <%= option%>
option <%= val%>
using
$(tmpl('form',{'option':[some arr]}))
this will cause a error says "Unexpected token < ";
so how can i do this?
option #{val}
is what you want to put the value of val
inside your option
element. Jade uses interpolation syntax similar to ruby/coffeescript.
It's unclear what your desired output is, but if you want those literal PHP-style tags, try:
option= '<%=' + val + '%>'