express - Condition for req.flash inside Jade template (Sails) -
express - Condition for req.flash inside Jade template (Sails) -
inside sails.js application, passing flash messages within jade templates. want display these messages within <section>
html5 tag, don't want tag nowadays if there no flash message.
here jade code :
- var flash = req.flash('error') if error || !!flash section.err= error | #{flash}
but doesn't work: displays right flash messages, puts everytime <section>
tag (even if flash
var contains no message).
node : req.flash('msgtype') flushed @ every call, had set within variable.
i have found how manage this, testing flash
's length :
- var flash = req.flash('error') if error || flash.length != 0 section.err= error | #{flash}
inspired https://github.com/balderdashy/sails/issues/1054#issuecomment-29045509
express jade connect sails.js connect-flash
Comments
Post a Comment