new_user
new_user

Reputation: 355

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}
                            }

Upvotes: 0

Views: 182

Answers (1)

marcobiedermann
marcobiedermann

Reputation: 4915

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

Upvotes: 1

Related Questions