registerPartial
Register a partial template that can be rendered with {{>key}}.
Deprecated 4.15
Pass renderer functions through the ViewModel instead. See the “Calling views” section in the can-stache docs for an example.
stache.registerPartial(name, template)
Registers a template so it can be rendered with {{>name}}
.
stache.registerPartial( "item.stache", "<li>{{name}}</li>" );
const itemsTemplate = stache( "{{#each(items)}}{{>item.stache}}{{/each}}" );
Parameters
- name
{String}
:The name of the partial.
- template
{String|view(data, helpers)}
:The string of a stache template or the returned result of a stache template.