hi all,
i tried to render mustache templates recursively like done
in the testcase. my code looks like this:
javascript:
- // controller that will care about events
- var StructureController = can.Control.extend({
- defaults: {
- viewId: 'jsEditStructure'
- }
- }, {
- /**
- * init
- */
- init: function(element, options) {
- this.element.html(can.view(this.options.viewId, options));
- }
- });
-
- // my testdata
- var options = {
- items: new can.List([{
- name: "item1",
- items: [{
- id: 1,
- name: "subitem1",
- type: "text",
- items: [{
- id: 2,
- name: "subsubitem1",
- type: "text",
- items: [{
- id: 2,
- name: "subsubsubitem1",
- type: "text",
- }]
- }]
- }, {
- id: 100,
- name: "subitem2",
- type: "text"
- }]
-
- }, {
- name: "item2"
- }])
- };
-
- var controller = new StructureController('#jsApp', options);
mustache template #jsEditStructure
:
-
new document
<br>
<ol>
{{#items}}
{{>jsRowStructure}}
{{/items}}
</ol>
and the #jsRowStructure template looks like this:
-
<li>
{{name}}< br >
< ol >
{{#items}}
{{>jsRowStructure}}
{{/items}}
</ol>
</li>
I'm getting always a '<error>'.
Does anybody know, how to do it right?
Thank you in advance,
roelfsche