Possible to make model available across multiple routes?


I’m a beginner, still learning Ember. I’m currently using Ember 1.10 and ember-cli 0.1.12 (latest). I also am currently using firebase. I apologize if this question would be more appropriate for stack overflow.

Right now my app works, but I thought maybe there would be a more elegant way of doing things.

I have a simple model:


import DS from 'ember-data';

export default DS.Model.extend({
   firstName: DS.attr('string'),
   lastName: DS.attr('string')  ...

I have some routes as pods which are:


Now, I can push data onto the model in employee-form.hbs, that’s fine. The trouble is that I can’t seem to pull the data for /pods/employee-list unless I create another router file.

So, I can


 import Ember from 'ember';
 export default Ember.Route.extend({

  model() {
    return this.store.findAll('employee');

or I can put that some information into


But isn’t there a way to make that same model available to all routes? When I try the store.find method on a route for index.js the data isn’t available?

I’ve tried adding the store.find on a controller as well with no luck.

Also - When I make the data available by setting the model on the route, in my htmlbars template I can’t seem to access the collection unless I state model:

 {{#each employees as |employee|}}

does not work

{{#each model as |employee|}}



You can do this in afterModel:


I will try that, thank you. I probably need to read the docs more closely to understand the interaction of models, controllers, and routes.