How to pass values to template events
Html
<template name="Header">
<div class="testClass">Text1</div> // pass a = 1
<div class="testClass">Text2</div> // pass a = 2
</template>
Javascript
Template.Header.events({
'click .testClass':function(event, template){
console.log(a) //print a values
}
});
You need to set the appropriate data context, using child templates for example :
HTML
<template name="Header">
{{> test text="Text1" a=1}}
{{> test text="Text2" a=2}}
</template>
<template name="test">
<div class="test">{{text}}</div>
</template>
JS
Template.test.events({
"click .test": function(event, template){
console.log(this.a);
}
});