Could I access helper in other helper in the same template?
Template.myTpl.helpers({
dataA: function(){
return data;
},
dataB: function(){
let callA = this.dataA();
//............
}
})
Please help me.
Could I access helper in other helper in the same template?
Template.myTpl.helpers({
dataA: function(){
return data;
},
dataB: function(){
let callA = this.dataA();
//............
}
})
Please help me.
Probably no elegant solution.
Checkout the ViewModel package. http://viewmodel.meteor.com
so you can do:
Template.t.viewmodel({
A: function(){return data;},
B: function(){ let callA = this.A();}
})
exactly what you are looking for. A & B could be used as standard helper in Blaze.
Thanks for your reply, but I never use viewModel
.
you can access it, but I would suggest put that functionality in normal function into onCreated element.
And helper to just call it - so you can call it from both helpers, without need to access it hacky way.
If you really have to call it directly, here you go
Template.nameOfTemplate.__helpers.get('nameOfHelper')();
Could I use
var instance = Template.instance();
instance .__helpers.get('nameOfHelper')();