测试属性的另一种方法是通过
locals对象间接引用它。使用您的示例:
var tpl = '<% if(locals.foo){ %>foo defined<% }else{ %>foo undefined<% } %>';console.log(ejs.render(tpl, { locals: { bar: "baz"} }));
测试属性的另一种方法是通过
locals对象间接引用它。使用您的示例:
var tpl = '<% if(locals.foo){ %>foo defined<% }else{ %>foo undefined<% } %>';console.log(ejs.render(tpl, { locals: { bar: "baz"} }));