Skip to content Skip to sidebar Skip to footer

Jade Html Escaped String

I have a problema with Jade, I take an unescaped string from db (something like this: '<mo>&' this string can contain some html code, I pass the string to the

Solution 1:

  1. I've set up default express app which uses jade as its template engine.

  2. Modified routes -> index.js to pass some encoded text

router.get('/', function(req, res) {
  res.render('index', { title: 'Express', encodedText: '&lt;mo&gt;&amp' });
});
  1. Modified views -> index.jade to display this text
block content
  h1= title
  p Welcome to #{title}
  p Encoded text !{encodedText}
  1. Result seems to be OK

enter image description here

Post a Comment for "Jade Html Escaped String"