I've got a base route which loads all categories as the model like this:
import Ember from 'ember';
export default Ember.Route.extend({
// retrieve all categories as they are needed in several places
model: function() {
return this.store.findAll('category');
}
})
Then there's a sidebar (base.sidebar) which is supposed to use the model from base. The controller looks like this:
import Ember from 'ember';
export default Ember.Controller.extend({
needs: ['base'],
categories: Ember.computed.alias('controllers.base.model'),
});
However this doesn't work anymore as of Ember 2.0. categories is just empty.
Which deprecation did I miss?
base.sidebaris a nested route ofbaseand you did not define a model hook forbase.sidebarroute, then you should be able to get parent model fromsidebarcontroller viathis.model. I don't know if it is documented somewhere, I found it by accident. - Gennady Dogaevsidebarits own model it won't work anymore so I prefer GJK's answer. - Hedge