Transforming Data with Filters
You can transform an expression by providing one or more filters in the template expression. Filters are provided using the |
pipe operator.
For example, to upper case the pet’s name:
I have one {{ @pet.type }} named {{ @pet.name | upper }}
Will produce the following:
I have one cat named TIGER
Some filters accept arguments. To pass arguments to a filter, include the arguments list in parentheses: filter(arg1, arg2, ...)
Popular transformation filters are:
title
: convert text to Title Casetruncate
: truncate the text with ellipses. For example:@description | truncate(10)
to truncate text to 10 characters.join
: concatenate values using a separator. For example:@names | join(",")
Last updated
Was this helpful?