I want to do something like this:
{{user.name.toLowerCase()}}
but I get this error:
Error: Parse error on line X:
...tatus {{user.name.toLowerCase()}}">
-----------------------^
Expecting 'ID', got 'undefined'
I want to do something like this:
{{user.name.toLowerCase()}}
but I get this error:
Error: Parse error on line X:
...tatus {{user.name.toLowerCase()}}">
-----------------------^
Expecting 'ID', got 'undefined'
Previous answer from @Eric seems not to work now, my solution is very similar, but probably the definition of helpers changed a little in new versions of handlebars:
and in the template
Cheers
If you're just trying to display some text as lowercased in HTML (regardless of whether or not it's generated by handlebars), you can use CSS and apply text-transform like so:
I created the following helper, but I'm curious if there's a better solution out there.
Doesn't hurt to also check and make sure it is a string and if not return nothing.
Usage :
Output :
As simply explained in the doc :
And just use it like this :