Templates
Aurelia's templating system provides powerful data binding, event handling, and control flow with intuitive syntax. Templates are HTML files enhanced with binding expressions and template controls.
Data Binding
Text Interpolation
Display dynamic content using string interpolation:
<h1>${title}</h1>
<p>Welcome, ${user.firstName} ${user.lastName}!</p>Property Binding
Bind to element properties and attributes:
<!-- Property binding -->
<input value.bind="message">
<img src.bind="imageUrl" alt.bind="imageAlt">
<!-- Attribute binding -->
<div class.bind="cssClass" id.bind="elementId">
<!-- Boolean attributes -->
<button disabled.bind="isLoading">Submit</button>Two-way Binding
Create two-way data flow with .bind:
As you type, both the input and paragraph update automatically.
Event Handling
Handle user interactions with .trigger:
Conditional Rendering
Show or hide content based on conditions:
List Rendering
Display dynamic lists with repeat.for:
Template References
Access DOM elements directly:
Template Variables
Create local variables within templates:
What's Next
Explore the complete template syntax overview
Learn about value converters for data transformation
Discover custom attributes for reusable behaviors
Last updated
Was this helpful?