new_user new_user - 1 day ago 5
Jade Question

How use if & else in Jade

I don't know how use if & else in Jade file.

I have:

br
each test in changes
.change-row
if test.property == "Image"
strong #{test.property}
else{
strong #{test.property}
span : #{test.newValue}
}

Answer

You have to remove the curly brace from else and indent your code properly.

br
each test in changes
  .change-row
    if test.property == "Image"
      strong #{test.property}
    else
      strong #{test.property}
      span :  #{test.newValue}

See http://learnjade.com/tour/conditionals/ for more information

Comments