Connect-flash message with HTML?

I would like to include the link in the connect-flash message text:

Js

req.flash("registerMessage", "Sorry, the User ID you chose is already in use. Please choose another. If you have already registered and need assistance logging in, <a href=\"http://www.example.com/support/\">contact support</a>");

      

EJS

<% if (message.length > 0) { %>
  <div class="alert alert-danger"><%= message %></div>
<% } %>

      

Result

<div class="alert alert-danger">Sorry, the User ID you chose is already in use. Please choose another. If you have already registered and need assistance logging in, &lt;a href=&quot;http://www.example.com/support/&quot;&gt;contact support&lt;/a&gt;.</div>

      

Is there a way to prevent Flash from appearing from HTML characters so that I can display links in my posts?

+3


source to share


1 answer


You can use:

<%- message %> 

      



to output unescaped HTML

+6


source







All Articles