Text interpolation
Last updated
Was this helpful?
Last updated
Was this helpful?
Text interpolation allows you to display values within your template views. By leveraging ${}
, a dollar sign followed by opening and closing curly braces, you can display values inside your views. The syntax will be familiar to you if you are familiar with .
To use text interpolation, wrap your expression in curly braces ${}
:
In this example, name
is a property in your view-model. Aurelia will automatically update the text whenever name
changes.
Aurelia 1 supports basic JavaScript expressions within interpolation:
You'll need to use value converters for more complex operations like string manipulation.
Keep your expressions simple. Move complex logic to your view model or use value converters.
For better performance with large lists, consider using the textContent
attribute:
Combine multiple value converters for complex transformations: