I have created a Handlebars helper function like this:
Here is the code in my JavaScript file:
Handlebars.registerHelper('switch', function (sw_val, options) {
if (sw_val != '*NONE' && sw_val != false && sw_val != "" && sw_val) {
return this;
}
return this;
});
And this is how I am using it in my template:
{{switch sw_val}} {{sw_val}} {{/switch}}
The purpose of this function is to show the value of sw_val only if there is one present. However, it doesn't seem to be working as expected. What do I need to modify in order to display the value correctly?