BorisMoore/jsrender — Issue #28: Error when nesting #each
Author: gcornejo
Created: 2011-11-24 09:32:14+00:00
State: open

A common use is nesting two or more #each.
I you have a JSON like

{
"name": "m-form",
"id": "m-form",
"action": "",
"method": "post",
"elements": [{
"type": "div",
"class": "m-form-div-email",
"elements": [{
"type": "label",
"for": "m-form-mail",
"html": "E-mail"
}, {
"name": "mail",
"id": "m-form-mail",
"type": "text"
}]
}, {
"type": "div",
"class": "m-form-div-country",
"elements": [{
"type": "label",
"for": "m-form-country",
"html": "País"
}, {
"type": "select",
"id": "m-form-country",
"name": "country",
"options": {
"US": "USA",
"ES": {
"selected": "true",
"value": "ES",
"html": "Spain"
},
"FR": "France",
"PT": "Portugal",
"UK": "United Kingdom"
}
}]
}]
}

And have the following templates,
formTemplate:

elementTemplate:

inputTemplate:

The result should be a:

FORM
DIV
...elements
DIV
...elements

But instead I get nested elements as:

FORM
DIV
...elements
DIV
...elements

Hope I'm clear and you can fix it.