我可以在html标签中使用ejs中的数据查询吗


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

我想将tag.fontcolor用于div样式的颜色但我有一个问题出现在下一张图片中:

属性值预期css(css属性值预期(

如果你能给我一个如何解决这个问题的提示,我将不胜感激。

在EJS模板中,对于不是文本的内容(属性、类…(,使用标记<%-而不是<%=

最新更新