在Spacebars中,您可以将包含参数与数据对象结合使用吗?

时间:2015-02-04 07:43:47

标签: meteor

这是我经历过几次的事情。我想做

{{> subtemplate item foo="bar"}}

以便subtemplate中的数据上下文包含所有项目字段和foo字段。在文档

中看不到任何方法

https://github.com/meteor/meteor/blob/devel/packages/spacebars/README.md

我知道我可以让我自己的助手combine像这样使用{{> subtemplate combine item "foo" "bar"}},但我希望有更好的方法。

1 个答案:

答案 0 :(得分:1)

您可以使用动态模板传递数据上下文吗?

 {{> Template.dynamic template=template [data=data] }}

请参阅http://docs.meteor.com/#/full/template_dynamic