I am new to meteor and have been trying to pass a value from an arraylist to a href pathfor element.
I have a template
<template name="Listing">
{{#each data}}
<a href="{{pathFor 'listingbycompanyL1' this}}">{{this}}</a><br/>
{{/each}}
<a href="javascript:history.back()">Back</a>
</template>
The data being sent into the template using a helper is basically an array of Strings from the following helper
'data': function(){
var distinctOrgListing = _.uniq(MyCustomCollection.find({}, {sort: {orgName: 1}, fields: {orgName: true}}).fetch().map(function(x) {return x.orgName;}), true);
console.log("Listing.helpers : distinct listings :" +distinctOrgListing)
return distinctOrgListing;
}
which will return me some data in form of a list of strings. For Example when printed to console i will get
Listing.helpers : distinct listings : a,b,c
I want to
- Send the value that i received to Iron Router as a param so that i can use the value do a collection search
My Router configuration for this is as follows :
this.route("listingbycompanyL1",{
path:"/listingL1",
layoutTemplate: 'ListingbycompanyL1',
data: function(){
var update=MyCustomCollection.find({orgName:"XXXX" }).fetch();
return {
update:update
};
}
});
How can i pass the values that i recieved (a,b,c) to IR and use it to do a search, where XXXX is a or b or c
orgname: "XXXX"
which has nothing to do witha,b,c
. Isa,b,c
always a triple or can be a tuple or a quadruple or any number? Have you thought about just setting a session variable (or reactive variable) in your template helper and referring to it from your route. – Michel Floyd