简体   繁体   中英

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

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

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM