ejs
ejs copied to clipboard
Unbuffered data not rendered on view from callback.
I've registered an object in app.locals and then accessing it in my layout view. The object is available and it accepts callback function as the argument due to async nature.
My snippet is:
<% flash(function(msgs) { %>
<% for(var type in msgs) { %>
<div class="alert alert-<%= type %>"><%= msgs[type] %></div>
<% console.log(msgs[type]) %>
<% } %>
<% }); %>
flash object is all available and it also outputs data in console.log but unfortunately doesn't render <div> element on web page. I tried adding - or = with opening marks but failed.
Seems something wrong in ejs while dealing the output from callback function
Can you paste the error you are seeing?