Reputation: 6707
I found a similar question. But this is not what I want.
Template.testTemp.helpers({
firstValue: function () {
return something
},
secondValue: function () {
// I want to access firstValue here.
// But I dont know what to do.
}
})
Is there anyone can help me?
Thanks!
Upvotes: 0
Views: 128
Reputation: 3592
You can hack a call to a template helper with:
Template.tplName.__helpers.get('helper').call()
MDG suggests using a regular function and then passing it to helpers, events and so on. See here.
Upvotes: 0
Reputation: 2147
If you define your helpers functions outside of the helper object that you are passing, you can use them like any other function.
var firstValue = function () {
return something;
};
var secondValue = function () {
var fv = firstValue();
return somethingelse;
};
Template.testTemp.helpers({
firstValue: firstValue,
secondValue: secondValue
});
Upvotes: 2