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/bindingsplugin 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 theviewModelto 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
childEventon<my-component>'s viewModel and callsmethodon the scope with the specified arguments:Binds to
domEventon<my-component>and callsmethodon the scope with the specified arguments.one-way to child
Updates
childPropin<my-component>'s viewModel withvaluein the scope:Updates the
child-attrattribute or property on<my-component>withvaluein the scope:one-way to parent
Updates
valuein the scope withchildPropin<my-component>'s viewModel:Updates
valuein the scope with thechild-attrattribute or property on<my-component>:two-way
Updates
childPropin<my-component>'s viewModel withvaluein the scope and vice versa:Updates the
child-attrattribute or property on<my-component>withvaluein the scope and vice versa: