简体   繁体   中英

Nodejs how to raw html

In my Nodejs app,my router is:

app.get('/admin/test',function(req,res){
  res.render('./admin/test.jade',{html:'<h1>hello world</h1>'});
})

view test.jade is :

div=html

The result is that I just see:

<h1>hello world</h1>

Not a h1 element.

So what should I do to show the raw html?

Using !{} to give the output parses the HTML:

div
   !{html}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM