Be patience I'm new at meteor.
I'm following the good getting start tutorial and just playing around.
Now I want to display only the todos belong to the current user.
I realized handlebar doesn't have an if expression statement and I bumped into this useful link
Logical operator in a handlebars.js {{#if}} conditional
I've tried with:
simple-todo.html
<template name="task">
{{#ifCond owner Meteor.userId() }}
<li class="{{#if checked}}checked{{/if}}">
<button class="delete">×</button>
<input type="checkbox" checked="{{checked}}" class="toggle-checked" />
<span class="text"><strong>{{username}}</strong> - {{text}}</span>
</li>
{{/ifCond}}
</template>
simple-todo.js
Handlebars.registerHelper('ifCond', function(v1, v2, options) {
if(v1 === v2) {
return options.fn(this);
}
return options.inverse(this);
});
1) is it the right place to set an handlebar helper ?
but I don't see any todo :(
Can you help me, please ?