Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

157
Views
EJS no puede encontrar una etiqueta de cierre por alguna razón

Si la variable <%=% activo> es mi contenido, quiero agregar un botón

 <% if (<%= active %> === "mycontent" ){ %> <div class="myContent-container"> <button class="btn btn-main-bg">Create</button> </div> <% } %>

Pero el sitio web dice que

 Error: Could not find matching close tag for "<%". at C:\Users\tlege\OneDrive\Masaüstü\Site(1.0)\node_modules\ejs\lib\ejs.js:740:19 at Array.forEach (<anonymous>) at Template.generateSource (C:\Users\tlege\OneDrive\Masaüstü\Site(1.0)\node_modules\ejs\lib\ejs.js:730:15) at Template.compile (C:\Users\tlege\OneDrive\Masaüstü\Site(1.0)\node_modules\ejs\lib\ejs.js:585:12) at Object.compile (C:\Users\tlege\OneDrive\Masaüstü\Site(1.0)\node_modules\ejs\lib\ejs.js:396:16) at handleCache (C:\Users\tlege\OneDrive\Masaüstü\Site(1.0)\node_modules\ejs\lib\ejs.js:233:18) at tryHandleCache (C:\Users\tlege\OneDrive\Masaüstü\Site(1.0)\node_modules\ejs\lib\ejs.js:272:16) at View.exports.renderFile [as engine] (C:\Users\tlege\OneDrive\Masaüstü\Site(1.0)\node_modules\ejs\lib\ejs.js:489:10) at View.render (C:\Users\tlege\OneDrive\Masaüstü\Site(1.0)\node_modules\express\lib\view.js:135:8) at tryRender (C:\Users\tlege\OneDrive\Masaüstü\Site(1.0)\node_modules\express\lib\application.js:640:10)
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

La respuesta fue tan simple. Todo lo que tenía que hacer era eliminar <%= y =%> del código. Debido a que ya es un bloque de código, no requiere caracteres ejs adicionales.

Así que la respuesta debería ser esta:

 <% if (active === "mycontent" ){ %> <div class="myContent-container"> <button class="btn btn-main-bg">Create</button> </div> <% } %>
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!