繁体   English   中英

如何在没有火焰模板的情况下使用角流星将参数传递给助手

[英]How pass parameter to helpers using angular-meteor without blaze template

使用Blaze可以做到这一点:如何在没有blaze模板的情况下在角流星中做到这一点? 请帮助我

  Template.dummy.helpers({
  getImage: function(imageId) {
  return Images.findOne(imageId);
       }
       });

    {{ getImage '1234' }}

如果我犯了任何错误,因为我是角流星的新手,这在角流星的助手中将如何发生?

这是我的代码:

<tr  class="ng-scope" align="center" ng-repeat="wordsList in addBundle.words(bundles)">
   this.helpers({
                words: (bundles) => {
                return words.find({});
    }
   });

因此,在angular-meteor中,无需将参数传递给助手,因为您可以并且应该使用常规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查询一起使用。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM