can-view-import
Version:
Import dependencies in CanJS views
20 lines (13 loc) • 953 B
Markdown
can-view-import.module module:to
can-view-import.attributes
Set the module that is referenced by the [can-view-import.from from attribute] to a [can-stache.helpers.let block-level variable].
`module:to="NAME"`
Sets up a [can-stache-bindings.toParent] binding to `NAME` in the block-level scope. Unlike [can-view-import.value value] this attribute isn't set by a Promise, so it's immediately available at initial template render, rather than being momentarily undefined.
{String} NAME The variable name to assign to in the [can-stache.helpers.let block-level scope]. This can be any string name you want to use, but it must not already be defined in the scope, or it will overwrite that existing value.
```html
<can-import from="app/person" module.default:to="person" />
<can-import from="app/helpers" module.properCase:to="properCase" />
<section>
hello {{properCase(person.name)}}
</section>
```