【发布时间】:2015-05-14 15:46:39
【问题描述】:
有没有办法将 .soy 文件中的全局变量设置为从 .html 传入的参数?这样所有模板都能够访问全局变量,以避免将相同参数重新传递给每个模板的冗余。
例如可以像这样工作的东西:
HTML:
document.write(wet4.gcweb.setGlobal({templatedomain:"example.ca"}));
大豆:
/**
* Test.
* @param templatedomain
*/
{template .setGlobal}
globalVariable = $templatedomain
{/template}
并且可以从所有其他模板访问 globalVariable
【问题讨论】:
标签: html google-closure-templates soy-templates