I want to check two more condition in IF Helper in Handlebars.
Can some one help me with it.
i want something like the below one :
status = "success";
{{ifCond status '==' 'success' && status '==' 'pass'}}
I want to check two more condition in IF Helper in Handlebars.
Can some one help me with it.
i want something like the below one :
status = "success";
{{ifCond status '==' 'success' && status '==' 'pass'}}
To my mind you have a problem because status can't be at the same time pass and success...
Use 2 variable instead status and check for example :
{ "status" : "success" , "check" : "pass" }
You can have more than just one parameter in a helper :
Handlebars.registerHelper('ifCond', function( cond1, cond2) {
if (cond1 == 'success' && cond2 == 'pass') {
return "OK";
} else {
return "KO";
}
});
the code in your template will look like that :
{{ifCond status check}}