2

I am struggling to create a dynamic link (include variable :id) into error flash message.

The link should redirect to existing entry.

JS

req.flash('errors', 'Name already in use!'+'<a href=\"/players/:id/edit"\>Edit existing player account</a>');

EJS

<% if (errors.length > 0) { %>
 <div class="alert alert-danger">
  <% for (error of errors) { %>
   <%- error %><br>
  <% } %>
 </div>
<% } %>
antzshrek
  • 9,276
  • 5
  • 26
  • 43

0 Answers0