My below code broken
span
a.active(href="#{code}")
- myArr.forEach(entry){
if(entry.code == code){
#{entry.ItemName}
}
}
My expected result is
<span><a href="John">John James</a></span>
You're mixing javascript to be executed by Jade with output code. Use this:
span
a.active(href = code)
each entry in myArr
if entry.code == code
= entry.ItemName
Changes:
each...in
tag = variable
for interpolation when possible, not #{variable}
if
doesn't need parens
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.