I have a jade template file that I am trying to run a conditional based on a JSON object within an each loop. What am I doing wrong to get the if statement to work?
each content in result.content
.panel.panel-default.result
.panel-heading.clearfix
a.gray(href='/content/#{content.id}') #{content.created_pretty}
a.btn.btn-primary.btn-sm.view(href="/content/#{content.id}") View
.status
.well
span.label.label-default #{content.priority}
if "#{content.priority}" == "URGENT"
.well
span.badge !
If I change the conditional to
if "URGENT" == "URGENT"
the code does run successfully.
I have also tried:
if '"#{content.priority}" == "URGENT"'
- if ("#{content.priority}" == "URGENT")
Any hlp would be greatly appreciated!
You have to do
if content.priority == "URGENT"
instead of
if "#{content.priority}" == "URGENT"