简体   繁体   中英

Can I use data query in ejs inside html tag

  <% tag.forEach(function(tag) { %>
    <div class="badge bg-primary" style="color: <%=tag.fontcolor%>"><%= tag.name %> 
    <button class="deleteTag" data-id="<%=tag.id%>">X</button></div>
  <% }) %>

I want to use tag.fontcolor for div style color but I have problem which appears in this next image:

property value expectedcss(css-propertyvalueexpected)

If you can give me a hint on how to solve this problem, that would be grateful.

in EJS templating, for what is not text (attributes, class, ...), use the tag <%- instead of <%=

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