Provides template event, one-way, and two-way bindings.
Use
The can/view/bindings plugin provides custom attributes useful for template declarative event, one-way and two-way
bindings on element attributes, component viewModels, and the scope. Bindings look like:
(event)="key()" for event binding.
{prop}="key" for one-way binding to a child.
{^prop}="key" for one-way binding to a parent.
{(prop)}="key" for two-way binding.
Adding $ to a binding like ($event)="key()" changes the binding from the viewModel to the element's attributes or properties.
The following are the bindings that should be used with can.stache and are compatible with the upcoming
3.0 release:
Use
The
can/view/bindings
plugin provides custom attributes useful for template declarative event, one-way and two-way bindings on element attributes, component viewModels, and the scope. Bindings look like:(event)="key()"
for event binding.{prop}="key"
for one-way binding to a child.{^prop}="key"
for one-way binding to a parent.{(prop)}="key"
for two-way binding.Adding $ to a binding like
($event)="key()"
changes the binding from theviewModel
to the element's attributes or properties.The following are the bindings that should be used with can.stache and are compatible with the upcoming 3.0 release:
event
Binds to
childEvent
on<my-component>
's viewModel and callsmethod
on the scope with the specified arguments:Binds to
domEvent
on<my-component>
and callsmethod
on the scope with the specified arguments.one-way to child
Updates
childProp
in<my-component>
's viewModel withvalue
in the scope:Updates the
child-attr
attribute or property on<my-component>
withvalue
in the scope:one-way to parent
Updates
value
in the scope withchildProp
in<my-component>
's viewModel:Updates
value
in the scope with thechild-attr
attribute or property on<my-component>
:two-way
Updates
childProp
in<my-component>
's viewModel withvalue
in the scope and vice versa:Updates the
child-attr
attribute or property on<my-component>
withvalue
in the scope and vice versa: