In my Jade view I have "raw" which contains retrieved mongodb data which I have passed to my jade view by res.render('jadeview',{raw:mongodbdata})
body
.container
h1 View Requests Page
table
tbody
tr
th ID
th Request's
th Description
th Current Status
- if(raw.length)
each item in raw
tr
td
a(href='/individualrequest/#{item._id}', id="idanch") #{item._id}
td
a(href='/individualrequest/#{item._id}', id="rqstanch") #{item.request}
td
a(href='/individualrequest/#{item._id}', id="descanch") #{item.description}
td
-if( #{item.approval} === 'true')
p Approved
else
p Rejected
But for last td where I am comparing one of the retrieved value of "raw" with if else statements, I'm getting error as "500 Unexpected character '#'" , I've tried without #{item.approval} instead , I compared 'true' === 'true', then its working fine, I'm getting the output in the Jade View Page, but Why it is not taking #{item.approval}, if I give only td #{item.approval}, I'm getting the value, but not with if/else, please help me on this
- if(item.approval)
应该可以正常工作,无需将其转换为字符串,然后与另一个字符串进行比较
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.