I want to do something like this:
{{user.name.toLowerCase()}}
but I get this error:
Error: Parse error on line X:
...tatus {{us
Doesn't hurt to also check and make sure it is a string and if not return nothing.
Handlebars.registerHelper('lowercase', function (str) {
if(str && typeof str === "string") {
return str.toLowerCase();
}
return '';
});
Usage :
// now let's pass a string or variable to our helper
{{lowercase 'MY NAME IS'}}
Output :
my name is