Normally we can do this in a normal object:
var obj = {
a: 2,
b: function() {
return this.a;
}
}
console.log( obj.b() ); // Output '2' in console
So we can get value of obj.a inside obj.b.
I'm trying to achieve the same thing in Meteor Blaze. In the template:
<template name="mytemplate">
{{b}}
</template>
and in the code behind:
Template.mytemplate.helpers({
a: 2,
b: function() {
return this.a;
}
}
Rendering 'mytemplate' will NOT output '2' as expected. How can I call 'a' method from 'b' function definition?