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
I've registered an object in
app.locals
and then accessing it in my layout view. The object is available and it acceptscallback function
as the argument due to async nature.My snippet is:
flash
object is all available and it also outputs data inconsole.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 fromcallback function