【发布时间】:2015-08-03 19:55:48
【问题描述】:
我正在为应该简单的事情而苦苦挣扎,但我无法理解。有错误还是只有我?我使用两种方法创建了两个简单的示例:1)registerHelper 和 2)parentData: HTML 是:
<body>
This is the body
{{> A}}
</body>
<template name="A">
This is "A"
{{> B}}
</template>
<template name="B">
This is "B"
{{> C}}
</template>
<template name="C">
This is "C"
{{foo}}
</template>
1) 的 Javascript 是:
Template.registerHelper(foo, function () {
return 'Hello';
});
对于情况 2) 是:
Template.A.helpers({
foo: function () {
return 'Hello';
}
});
Template.C.helpers({
foo: function () {
return Template.parentData(2);
}
});
怎么了?
【问题讨论】:
标签: meteor