简体   繁体   中英

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

This was possible with Blaze: how do I have to do it in angular-meteor without blaze template? Kindly help me

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

    {{ getImage '1234' }}

How this will happened in helpers of angular-meteor kindly correct my syntax if I am making any mistake as I am new to angular-meteor

This is my code:

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

So in angular-meteor there is no need to pass parameters to the helpers because you can and should use regular Angular's scope variables.

In your case, you also want to make them reactive (trigger an update in Meteor) so you should add getReactively when you use them.

Here is an example of your need:

<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')});
  }
});

of course, if querying bundles from words requires more complex query, you can use my example with any other Mongo query you like.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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