Reputation: 4084
I'm new to Ember.js and I'm trying to get my head around it.
I have the following code (http://jsfiddle.net/6wPmW/ for a working example):
<script type="text/x-handlebars">
<div id="ViewAddresses" class="location_search_results selected_searches clearfix">
<div>
<div>
{{#each MapSearch.ViewAddressesC}}
<div class="row">ghfdg</div>
{{/each}}
</div>
</div>
</div>
</script>
JS:
MapSearch = Ember.Application.create();
MapSearch.ListAddress = Ember.Object.extend({
list_info: null,
node_level: null,
node_value: null,
removed_properties: null
});
MapSearch.ViewAddressListC = Ember.ArrayController.create({
content: [],
initialize: function() {
me = this;
var l = MapSearch.ListAddress.create({
node_level: "test",
node_value: "test"
});
me.pushObject(l);
var l = MapSearch.ListAddress.create({
node_level: "test",
node_value: "test"
});
me.pushObject(l);
console.log(me);
}
});
MapSearch.ViewAddressListC.initialize();
console.log(MapSearch.ViewAddressListC.get("content"));
Surely I should get two <divs>
created from the each loop?
Upvotes: 0
Views: 950
Reputation: 10726
The error is in your template:
{{#each MapSearch.ViewAddressesC}}
should be
{{#each MapSearch.ViewAddressListC}}
See this JSFiddle.
Upvotes: 2