Monday, 2 September 2013

Failed to pass value to handlebars helper

Failed to pass value to handlebars helper

I want to compare two values in template hence i have used handlebars
helper as given below :
Handlebars.registerHelper('ifCond', function(v1, v2, options) {
console.log(v1);console.log(v2);
if(v1 === v2) {
return options.fn(this);
}
return options.inverse(this);
});
My template code :
{{#ifCond item.id 1}}
<div class="row" style="margin-top:0px;">
{{else}}
<div class="row" style="margin-top:5px;">
{{/ifCond}}
But value of item.id is not getting pass to helper it showing its value as
"item.id".
Can anyone tell me what is the mistake in my above code?

No comments:

Post a Comment