Reputation: 10404
I'm passing variables to template:
{{> myTemplate myVariable}}
Inside myTemplate I access it with:
<template name="myTemplate">
{{this}}
</template>
Where this
will be myVariable
How can I access myVariable
from the code - onCreated, onRendered, helpers of myTemplate.
Example:
Template.myTemplate.onCreated(function(){
// How access myVariable here?
});
or
Template.myTemplate.onRendered(function(){
// How access myVariable here?
});
Upvotes: 0
Views: 150
Reputation: 51
In the onCreated and onRendered callbacks, this.data
points to the passed data:
Template.myTemplate.onCreated(function(){
console.log(this.data);
});
Template.myTemplate.onRendered(function(){
console.log(this.data);
});
Upvotes: 1