Ember API Documentation

To get started, choose a project (Ember or Ember Data) and a version from the dropdown menu. Ember has core methods used in any app, while Ember Data has documentation of the built-in library for making requests to a back end. If you're looking for documentation of the command line tool used to generate files, build your app, and more, visit ember-cli. The latest testing API is available at ember-test-helpers.

Commonly searched-for documentation

  • Component - a view that is completely isolated
  • Computed Properties - declare functions as properties
  • Computed Macros - shorter ways of expressing certain types of computed properties
  • EmberArray - contains methods like forEach and mapBy that help you iterate over Ember Objects
  • EmberObject - the main base class for all Ember objects, including the get and set methods
  • Ember.Templates.helpers - built-in functions that can be used in templates, such as the each helper
  • Helpers - a way to define custom display functions that are used in templates
  • Route - used to define individual routes, including the model hook for loading data
  • Service - an Ember object that lives for the duration of the application, and can be made available in different parts of your application

How to import and use packages

Ember has a modern ECMAScript 2015 (also known as ES2015 or ES6) modules API. Each major class and its supporting functions live in a dedicated module, which you can import like this:

1
2
3
4
import Component from '@ember/component';
export default Component.extend({
  // this is the current way
});

When working with older Ember codebases, you may see a different set of imports. Before the Ember JavaScript Modules API design, developers had to import the entire Ember framework as a single package. That package was an object which contained all the Ember classes and functions, so you will see code that pulls the classes or functions off that object, like this:

1
2
3
4
import Ember from 'ember';
export default Ember.Component.extend({
  // this is the old way
});

For new apps, you should always prefer the the JavaScript Modules API, and old apps should migrate to it over time: it allows the building of smaller packages based on chunks of functionality and importing only parts of the Ember framework that are needed.

The most up-to-date and complete mappings between the previous API and the new JavaScript Modules API can be found at the ember-rfc176-data repository. Codemod tooling is also available to help migrate existing Ember projects to the new JavaScript Modules API syntax.

Useful links