Store
In initializer injects a store service into the application routes. The store service is a facade to the resource services in the application. A store method requires an argument - the resource name (plural, e.g. 'posts'). The store calls the same method on the resource service.
This is the interface for the store, which is a facade. An initializer injects all the services into the store (a service for each resource type).
An example route hook to find all post resources from the posts service:
import Ember from 'ember';
export default Ember.Route.extend({
model() {
return this.store.find('post');
}
});
Notice the singular resource type 'post' above. To find the appropriate resource service, the store will pluralize the resource name. To find a singular resource, e.g. me, use the {singleton: true} option, this.store.find('post', {singleton: true});. Also, you may directly call the injected service, e.g. this.posts.find().