How to access main Model object on swig?

时间:2015-11-12 10:45:42

标签: javascript node.js swig-template

In a swig file I want to see all available properties that it is receiving.

Is there a way to access it? Or can I only access its properties?

.js

res.render('list.swig', result);

list.swig

{{ Model|json }}

1 个答案:

答案 0 :(得分:0)

我认为你能做到的唯一方法是在node_modules下打开swig并转到/lib/swig.js。然后找到code for renderFile

有三个参数pathNamelocalscb。您可以对pathName进行条件检查,如果您正在寻找,可以记录locals