I'm having a part of my applications split away from the main template in a sepparate handlebars template using {{render "header"}} to render that at the right place.
This sepparate template also has its own controller to display some data from the model (App.Notification).
What I want to do is display a limited amount of notifications and the number of new notifications in total.
Ember data loads 10 entries from the server when the controller's notifications property is called in an each loop but as soon as I try to limit the amount of shown notifications via splice, it won't return any data.
Basically, I'm having trouble handling model data if I can't set the controllers model in a route, I assume that's why the normal syntax with slice isn't working in this case.
I already searched Stackoverflow and the Ember docs but only found examples with normal Route -> Controller setup but nothing on this particular topic, so the question is, how to correctly handle model data in this setup?
Header Controller:
App.HeaderController = Ember.Controller.extend
notificationNew: (->
@get('notifications').filterBy('seen', false).get('length')
).property('notifications')
notifications: (->
@store.find('notification').slice(0, 2)
).property('@each.notification')
Template:
{{#each notifications}}
...
{{/each}}