Skip to content
Sarsa Parilla edited this page Aug 5, 2025 · 8 revisions

Define a variable whose value is bound to an expression. The variable is available to binding statements declared on this element and all its descendants.

<div bind-repeater-i="#todos.length"
	bind-var-item="#todos[#i]"
	bind-var-status="#todos[#i].done ? 'completed' : 'active'">
	{{#item.text}} is {{#status}}
</div>

Note: Variables declared on the same element cannot reference each other (because HTML attributes are unordered). Therefore, we added a bind-var2- directive for this special case. Variables defined with bind-var2- can reference those defined by bind-var- on the same element.

Clone this wiki locally