Hello,
I have JSON response from external php file. I have helper function which calls the remote method to get the JSON data.
Template.products.helpers({
'showproducts' ()
{
// Remote method has HTTP function which fetches the JSON response.
Meteor.call("getproducts",function(error, result)
{
// This works perfectly. Shows in console
show = result.data.products[0];
console.log(show);
});
},
});
Added {{showproducts}} in template but not working.
This doesn’t work.
Template.products.helpers({
'showproducts' ()
{
var show;
// Remote method has HTTP function which fetches the JSON response.
Meteor.call("getproducts",function(error, result)
{
show = result.data.products[0];
});
return show;
},
});
This doesn’t the value. I guess the problem is that it takes few seconds to load JSON data.
How can I do this ? Please help.
Thank You!