Reputation: 11039
I have a template settings
in which I have an autoform.
I add a hook to my autoform inside the onRendered
function
Template.settings.onRendered( () => {
AutoForm.addHooks( 'editForm', {
onSuccess: function( formType, result ) {
//
}
} );
} );
How can I, inside my onSuccess
get a variable populated in the template through Template.settings.helpers
?
I have tried Template.instance().variableName
, but it cannot be found.
Upvotes: 1
Views: 1045
Reputation: 5088
From the Meteor docs:
In the body of a callback, this is a template instance object that is unique to this occurrence of the template and persists across re-renderings. Use the onCreated and onDestroyed callbacks to perform initialization or clean-up on the object.
http://docs.meteor.com/#/full/template_onRendered
But I think you need to make use of function
instead of an ES2015 arrow function or this
won't be as expected.
Also, you would need to add the line:
const self = this;
And then use self
if you want to access it within the Autoform
function.
Upvotes: 2