Can I use conditional statements with EJS templates (in JMVC)?

前端 未结 7 482
误落风尘
误落风尘 2020-11-30 19:16

and if yes, what is the syntax? My goal is to prepend an \'s\' to the word \'comment\' when there is more than one. in an jQuery.ejs template in a JMVC app. The following br

相关标签:
7条回答
  • 2020-11-30 20:07

    EJS seems to behave differently depending on whether you use { } notation or not:

    I have checked and the following condition is evaluated as you would expect:

    <%if (3==3) {%>  TEXT PRINTED  <%}%>
    <%if (3==4) {%>  TEXT NOT PRINTED  <%}%>
    

    while this one doesn't:

    <%if (3==3) %>  TEXT PRINTED  <% %>
    <%if (3==4) %>  TEXT PRINTED  <% %>  
    
    0 讨论(0)
提交回复
热议问题