Reputation: 786
In my Ember Application Handlebars template, I need some model data to display. In Index or other routes, these types of code work but in application route they are not working. Application Route:
App.ApplicationRoute = Ember.Route.extend({
model: function()
{
return this.store.findAll('archive');
}
});
Application template:
<script type="text/x-handlebars" data-template-name="application">
{{#each}}
{{title}}
{{/each}}
</script>
DS.Model:
App.ApplicationAdapter = DS.FixtureAdapter;
App.Archive = DS.Model.extend({
title: DS.attr('string'),
day: DS.attr('number')
});
App.Archive.FIXTURES = [
{
"id":1,
"title": "First title",
"day": 06
},
{
"id":2,
"title": "Second title",
"day": 08
}
];
I couldn't find out where is the prob. In Ember, can I use model for Application template?
Upvotes: 3
Views: 804
Reputation: 47367
Yes definitely, the main reason your code wouldn't be working would be if you have an application controller defined that wasn't an ArrayController.
Example: http://emberjs.jsbin.com/OxIDiVU/1115/edit
Upvotes: 3