[英]Patterns and practices for passing data between templates
Some different possibilities: 一些不同的可能性:
With block: 带块:
{{#with post}}
{{> postTemplate}}
{{/with}}
Passing arguments: 传递参数:
{{> postTemplate post=post anotherArg=5 moreData="xyz"}}
If you also want to use iron-router (and basically all projects should), you can use "data" to return the data context for the page you're loading. 如果您还想使用Iron-Router(基本上所有项目都应如此),则可以使用“数据”来返回要加载页面的数据上下文。
Also, note that child templates inherent parent data contexts. 另外,请注意,子模板是固有的父数据上下文。 (They don't inherent helpers though).
(尽管他们不是天生的帮手)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.