If I have a binding {{# each}} in Meteor, and I want to update the property on only one instance of the template inside #each. How can I do it? I tried setting the value in the template object inside the event map, but this does not seem to be reactive. I also tried to bind the Session property, but this will update each instance instead of what I want ...
eg:
{{#each dates}} {{> dateTemplate}} {{/each}} <template name="dateTemplate"> {{date}} <span style="color: red;">{{errorMsg}}</span> <--- how do i update errorMsg? </template> Template.dateTemplate.events({ 'click': function(event, template) { template.errorMsg = 'not valid'; <--- this doesn't do anything } });
CHANGE ADDRESS ANSWER BELOW:
Template.dateTemplate.events({ 'click': function(event, template) { template.errorMsg = function() { return 'not valid';} <--- this also doesn't do anything } });
source share