Answer the question
In order to leave comments, you need to log in
How to check equality of variables in handlebars?
How can validation be implemented in this way? {{#if innNumber === this.inn}}YES!{{/if}}
innNumber is passed to the template function when called
. As a result, this is necessary so that in the loop when outputting from json, for example, highlight the line if the value matches
Answer the question
In order to leave comments, you need to log in
You can register Helper:
Handlebars.registerHelper('iff', function(v1, v2, options) {
if(v1 === v2) {
return options.fn(this);
}
return options.inverse(this);
});
{{#iff v1 v2}}
{{v1}} === {{v2}}
{{else}}
{{v1}} != {{v2}}
{{/iff}}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question