Store

The central service for fetching, creating, and caching records.

Since Ember 4/5 (Octane) Spec ↗

Syntax

@service store; this.store.findRecord(type, id)

Returns

Store — The EmberData store service.

Examples

import Route from '@ember/routing/route';
import { service } from '@ember/service';

export default class PostsRoute extends Route {
  @service store;

  model() {
    return this.store.findAll('post');
  }
}

Notes

Inject the store with @service. It deduplicates requests and caches records by type and id, so repeated lookups return the same identity. Use findRecord/findAll/query to fetch and createRecord to make new ones.