Accessing passed EJS variable in Javascript file

前端 未结 5 882
轻奢々
轻奢々 2020-12-05 12:05

RESTful routes js file:

// index route - show all todos
router.get(\"/\", middleware.isLoggedIn,function(req,res) {
  Todo.find({ \"author.id\" : req.user._i         


        
5条回答
  •  萌比男神i
    2020-12-05 13:03

    http://ejs.co/ says

    1. <% 'Scriptlet' tag, for control-flow, no output
    2. <%= Outputs the value into the template (HTML escaped)
    3. <%- Outputs the unescaped value into the template
    4. <%# Comment tag, no execution, no output

    Can you try using <%- in ejs to read variable value?

提交回复
热议问题