Ok, so this is driving me crazy, I am making a prototype of a site. All I want is to add some json to the view. My json is an array, with some nested arrays. This would be an example of the json:
var facetList = [
{
'Alias' : 'WaterSaving',
'DisplayName' : 'Vand besparende',
'id':47,
'Facets' : [
{
'DisplayName' : 'false',
'FacetId' : 47,
'Value' : 'false',
'id':0
},
{ 'DisplayName' : 'true',
'FacetId' : 47,
'Value' : 'true',
'id':1
}
]
},
{
'Alias' : 'Type',
'DisplayName' : 'Type',
'id':48,
'Facets' : [
{
'DisplayName' : 'håndvask',
'FacetId' : 48,
'Value' : 'håndvask',
'id':2
},
{
'DisplayName' : 'køkken',
'FacetId' : 48,
'Value' : 'køkken',
'id':3
}
]
}
];
For this I use an ArrayController like so:
App.FacetController = Ember.ArrayController.create();
App.FacetController.set('content', facetList);
When I try to render this in the view like so:
<div>
<h2>Filtre</h2>
{{#each App.FacetController}}
{{DisplayName}} {{input type="checkbox" name="isAdmin" checked=valgt}}
<br/>
{{Facets.[1].DisplayName}}
{{this.Facets.[1].DisplayName}}
{{Facets}}
{{#each Facets}}
{{#each this}}
this
{{/each}}
{{/each}}
{{/each}}
</div>
I get this output:
Vand besparende
true true [object Object],[object Object] Type
køkken køkken [object Object],[object Object]
It is very clear that handlebars sees an array - but it refuses to loop over this array! What am I doing wrong?
I use Ember version 1.4.0