Here is my event code:
Template.pricing_report.events({ 'click #btn_report_filter': function(){ from_date = $("#datepicker1").val(); to_date = $("#datepicker2").val(); date_n = new Date(from_date); from_iso = date_n.toISOString(); date_o = new Date(to_date); to_iso = date_o.toISOString(); } });
I want to use the from_iso and to_iso in my helpers, which are given below:
Template.pricing_report.helpers({ 'preportdata':function(){ return price.find(); }, 'preportdata_test':function(){ return price.find({ date: { $gte: from_iso, $lt: to_iso } }); }
As you can see, I used my from_iso and to_iso inside the find function, but I canβt get the value for the helper function.
I also tried using console.log (from_iso) inside my helper function, but also did not display anything.
So how can I use these variables?
user4810329
source share