How to import a recursive stache template

(Don’t know it this is the right forum)
When I try to import a stache template that has a recursive loop, I get an error.

Uncaught Error: can.view: No template or empty template:recursive_template.mustache
Info: can/view/view.js: There is no template or an empty template at upload_main_tree_views_smscTree_stache.mustache

I import the template like this:

import recursive_template from './views/template.stache';

The template is used like this:

this.element.html(recursive_template({children: items}));

The template looks like this.
If there are children, it uses the same template again.

	{{#each children}}

The documentation states that the {{>key}} can also be a function, right?

Or, do I have to register the template somehow?


var frag = recursive_template(
  {children: items}, 
    partials: {recursive_template: recursive_template}


1 Like

Thx, Justin. That works.