When you want to use ejs to print normally,

Asked 2 years ago, Updated 2 years ago, 115 views

How can ejs display characters without using <%=%>?

For example, I don't know how to write when:

<a href="class="<%
// Add active to class depending on condition
if(hoge){
  "active"
}
%>">

javascript node.js

2022-09-30 20:12

1 Answers

I'm afraid I don't have the environment at hand, but how about the following?

<%var active=hoge?"active":"%>
<a href="class="<%=active%>">>


2022-09-30 20:12

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.