[英]How do I iterate over an object within a Soy file when using Google closure templates?
[英]Closure templates from multiple soy files
我有一个名为templates.soy
,我希望能够从单独的文件中调用模板(希望不时以编程方式覆盖该文件)。 我可以在同一个文件中调用模板。 目前我有:
{namespace plugin.example}
/**
* Template for the build
*/
{template .anthill}
<html>
<head>
...
<body>
<h2>My Form</h2>
<br />
{call .form /} //This works
{call random.me.moreFields /} //This throws an error "Attempting to render undefined template 'random.me.moreFields'
</body>
</html>
{/template}
/**
* Form info
*/
{template .form}
//custom html form stuff
{/template}
{namespace random.me}
/**
* Testing more soy files
*/
{template .moreFields}
//custom html stuff
{/template}
这可能吗?
是的你可以。 每个组件或页面拥有一个文件甚至是最佳实践。
只需同时编译所有模板。
java -jar SoyToJsSrcCompiler.jar --srcs templates.soy,selectField.soy
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.