How does != work in jade code below.. != messages()
extends layout
block content
.spacer
.container
.row
.col-lg-8.col-lg-offset-2.col-md-10.col-md-offset-1
a(class='btn btn-tiny btn-primary' href='/manage/categories/add') Create Category
h1= title
small
a(href='/manage/articles') Manage Articles
!= messages()
table(class='table table-striped')
tr
th Category Title
th
each category, i in categories
tr
td #{category.title}
td
a(class="btn btn-tiny btn-default" href="/manage/categories/edit/#{category._id}") Edit
app.js
app.use(require('connect-flash')());
app.use(function (req, res, next) {
res.locals.messages = require('express-messages')(req, res);
next();
});
It is called "interpolation".
It means that "messages()" is escaped, e.g. if you have following code:
var randomText = '<p> this is a <strong>text</strong></p>'
p= randomText
which would normally, unescaped, produce just what it is:
'<p> this is a <strong>text</strong></p>'
but if I typed this:
p!= randomText
it would actually became a p tag, looking exactly like this:
this is a text
Hope it helps you :-)
You can read more about in the documentation, here: https://pugjs.org/language/interpolation.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With