Element content
When manipulating element content in Aurelia, you have several options at your disposal. Let's explore how to bind values to innerHTML
, textContent
, and more.
In the previous section on text interpolation, we showed how you can use interpolation to display values, which is the equivalent of binding to the textContent
property.
Using textContent Binding
For more control, you can bind directly to textContent
:
This is useful when you want to set the entire text content of an element.
HTML content binding
To bind HTML content, use the innerHTML
attribute:
Controlling text direction
In your view-model:
Raw HTML Binding
If you need to bind raw HTML and you're sure it's safe, Aurelia provides a innerhtml
binding command:
Last updated
Was this helpful?