Hi,
How do I call a function in a template from the router.js code?
In my router.js I have the following…
FlowRouter.route('/editProduct/:_id', {
action: function () {
BlazeLayout.render("appLayout", {content: "editProduct" });
},
triggersExit: [ autoSave ]
});
function autoSave(){
alert('Here..')
}
This works ok, but I want to replace the alert with a call to an autoSave helper function inside the editContent template code…
function autoSave(){
Template.editProduct.autoSave();
}
Is this sensible? and if so how do I define the autoSave in the template?
Thanks