我从Meteor doc知道我可以通过编写
来评估模板的订阅状态{{#if Template.subscriptionsReady}}
<!-- subscriptions ready -->
{{else}}
<!-- loading -->
{{/if}}
如果想要访问模板的父状态怎么办? 我想写点像
{{#if Template.parent.subscriptionsReady}}
<!-- parent's subscriptions ready -->
{{else}}
<!-- loading -->
{{/if}}
答案 0 :(得分:0)
我最终使用了meteor-template-extension包。
我创建了一个帮手:
Template.myTpl.helpers({
parentSubscriptionsReady: function () {
return Template.instance().parent(1).subscriptionsReady();
}
});
我这样使用它:
{{#if parentSubscriptionsReady}}
<!-- parent's subscriptions ready -->
{{else}}
<!-- loading -->
{{/if}}
当然可以使用Template.registerHelper