我正在尝试理解ejs过滤器,但我无法让它工作:
Server.js
var ejs = require('ejs');
ejs.filters.test = function() {
//empty for test
};Routes.js
app.get('/index', function(req, res) {
res.render('index.ejs', {
data : someData
});
});Index.ejs:
<% test %>错误:
...test is not defined
at buf.push.__stack.lineno (eval at <anonymous> ....发布于 2014-09-02 20:15:37
过滤器应用于具有下列语法的某些数据。
<%=: data | test %>缺少=:和要过滤的数据的位置。
https://stackoverflow.com/questions/25631300
复制相似问题