A list of all custom elements and attributes that CanJS supports.
can.Component, can.view.attr, can.view.tag let you create custom element and
attribute behavior. However, CanJS and its plugins supply the following behaviors:
Core
With the release of canJS 2.3 the new binding syntax provides powerful event, one-way and two-way bindings on element attributes, component viewModels, and the scope.
Export child-prop from <example>'s viewModel into *foobar (reference scope) and two-way bind *foobar to the element's attribute. If the element's attribute changes, *foobar will change and updates the child-prop on <example>. If child-prop nothing will happen.
Two-Way-Binding
Two-Way binds the value in the scope and the child component's viewModel property (child-prop)
Export and two-way bind child-prop from <example>'s viewModel into *foobar (reference scope) and two-way bind *foobar to the element's attribute. If the element's attribute changes, *foobar will change and updates the child-prop on <example>. If child-prop changes, *foobar will change and updates the element's value attribute.
Passes primitive to viewModel
This does not binding properties together but show you how you can pass a primitive string to a component viewModel
<example child-prop="foobar"/>
Plugins
The following functionality is available within plugins:
can-autorender - Autorenders a script tag within the page as a template.
<can-import> - Imports dependencies in
a stache template using a System loader, StealJS, or AMD. This only works
in templates loaded by can-autorender or imported
with the system plugin.
can.Component, can.view.attr, can.view.tag let you create custom element and attribute behavior. However, CanJS and its plugins supply the following behaviors:
Core
With the release of canJS 2.3 the new binding syntax provides powerful event, one-way and two-way bindings on element attributes, component viewModels, and the scope.
Binds events on viewModel and calls method on the scope with the specified arguments
Binds events on a
DOMEventand calls method on the scope with the specified argumentsOne-Way binds the
valuein the scope to a child component's viewModel property (child-prop)Updates
child-propwhenvaluechangesOne-Way binds the
valuein the scope to a element's attribute or property.Updates
placeholderwhenvaluechangesReverse the One-Way binding by adding a
^at the beginning.Updates
valuewhenchild-propchangesExport a viewModel to the references scope by adding an attribute with the hypenated name of the reference scope property
Export
child-propfrom<example>'s viewModel into*foobar(reference scope) and two-way bind*foobarto the element's attribute. If the element's attribute changes,*foobarwill change and updates thechild-propon<example>. Ifchild-propnothing will happen.Two-Way-Binding
Two-Way binds the
valuein the scope and the child component's viewModel property (child-prop)Updates
child-propwhenvaluechanges, updatesvaluewhenchild-propchanges.Two-Way binds the
valuein the scope and the element's attribute or property.Updates the element's attribute
valuewhenmyValuechanges, updatesmyValuewhen the element's attributevaluechanges.Export a viewModel to the references scope by adding an attribute with the hypenated name of the reference scope property
Export and two-way bind
child-propfrom<example>'s viewModel into*foobar(reference scope) and two-way bind*foobarto the element's attribute. If the element's attribute changes,*foobarwill change and updates thechild-propon<example>. Ifchild-propchanges,*foobarwill change and updates the element's value attribute.Passes primitive to viewModel This does not binding properties together but show you how you can pass a primitive string to a component viewModel
Plugins
The following functionality is available within plugins:
can-autorender - Autorenders a script tag within the page as a template.
<can-import> - Imports dependencies in a stache template using a System loader, StealJS, or AMD. This only works in templates loaded by can-autorender or imported with the system plugin.
You can also dynamically import a module and nest content within: