这在blaze中是可能的:没有blaze模板,我如何在angular-meteor中做到这一点?请帮帮我
Template.dummy.helpers({
getImage: function(imageId) {
return Images.findOne(imageId);
}
});
{{ getImage '1234' }}这将如何在angular-meteor的助手中发生?如果我犯了任何错误,请纠正我的语法,因为我是新接触angular-meteor的人
这是我的代码:
<tr class="ng-scope" align="center" ng-repeat="wordsList in addBundle.words(bundles)">
this.helpers({
words: (bundles) => {
return words.find({});
}
});发布于 2016-04-13 05:11:25
因此,在angular-meteor中,不需要将参数传递给helper,因为您可以并且应该使用常规Angular的作用域变量。
在您的例子中,您还希望使它们具有响应性(在Meteor中触发更新),因此您应该在使用它们时添加getReactively。
以下是您的需求示例:
<tr class="ng-scope" align="center" ng-repeat="wordsList in
words">this.bundles = 'some bundle thing';
this.helpers({
words: () => {
return words.find({bundles: this.getReactively('bundles')});
}
});当然,如果从单词中查询包需要更复杂的查询,您可以将我的示例与您喜欢的任何其他Mongo查询一起使用。
https://stackoverflow.com/questions/36530718
复制相似问题