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
DOMEvent
and calls method on the scope with the specified argumentsOne-Way binds the
value
in the scope to a child component's viewModel property (child-prop
)Updates
child-prop
whenvalue
changesOne-Way binds the
value
in the scope to a element's attribute or property.Updates
placeholder
whenvalue
changesReverse the One-Way binding by adding a
^
at the beginning.Updates
value
whenchild-prop
changesExport a viewModel to the references scope by adding an attribute with the hypenated name of the reference scope property
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 thechild-prop
on<example>
. Ifchild-prop
nothing will happen.Two-Way-Binding
Two-Way binds the
value
in the scope and the child component's viewModel property (child-prop
)Updates
child-prop
whenvalue
changes, updatesvalue
whenchild-prop
changes.Two-Way binds the
value
in the scope and the element's attribute or property.Updates the element's attribute
value
whenmyValue
changes, updatesmyValue
when the element's attributevalue
changes.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-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 thechild-prop
on<example>
. Ifchild-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
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: