简体   繁体   中英

what is this happening .It showing me this error Could not find matching close tag for "<%"

EJS template code,Where the hell is the problem!!!

<ul>
<%if(<%=itemslist[0]%>!=""){%>

<%for(let i=0;i<=<%=itemslist.length%>;i++){%>
<li> <%=itemslist[i]%> </li>
<%}%>  

<%}%>
 </ul>

Don't use ejs blocks inside of ejs blocks:

<ul>
<%if(itemslist[0]!=""){%>

<%for(let i=0;i<=itemslist.length;i++){%>
<li> <%=itemslist[i]%> </li>
<%}%>  

<%}%>
 </ul>

Not familiar with this style but I would guess it is the nesting of the <% %> tags. Does it work if you remove the <%= %> like below?

  <%if(itemslist[0]!=""){%>
    <%for(let i=0;i<=itemslist.length;i++){%>
      <li> <%=itemslist[i]%> </li>
    <%}%>
  <%}%>

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