-
Notifications
You must be signed in to change notification settings - Fork 5
Bind Var
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 withbind-var2-
can reference those defined bybind-var-
on the same element.