Template.Demo.onCreated(function() {
this.test = 'Text';
});
How to access that template's instance test
key in Blaze directly (without creating a helper function)?
{{Template.instance.test}}
seems not to work (it was suggested here).
I don't believe this is possible with current versions of Blaze. That being said, you can simulate this by declaring a single global Template helper function, like:
Template.registerHelper('instance', function () {
return Template.instance();
});
Just define this once in a common client location, and you can then reference instance
in any of your Template's. So you could reference your test
variable like:
{{instance.test}}