Is it possible to call a helper within helper declaration?
I define two helpers: someFunctionA
and someFunctionB
. I would like to use someFunctionB
and inside that call someFunctionA
I've tried calling someFunctionA()
and this.someFunctionA()
.
TEMPLATE
<span>{{:~someFunctionB(123)}}<span>
JS
$.views.helpers({
someFunctionA: function(value)
{
return value++;
},
someFunctionB: function(value)
{
new_value = someFunctionA(value);
return "the value is: " + value;
}
});
You can do
new_value = this.ctxPrm("someFunctionA")(value);
See www.jsviews.com/#viewobject@ctxprm
Or you can simply do
functionA() {
return value++;
}
functionB() {
new_value = functionA(value);
return "the value is: " + value;
}
...
$.views.helpers({
someFunctionA: functionA,
someFunctionB: functionB
});