Ember.js 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

ECMAScript 2015 (also known as ES2015 or ES6) introduced a syntax for importing and exporting values from modules. Ember has made use of ES6 modules for quite a while now. However, the entire Ember framework was previously imported as a single package. Rather than importing specific parts of the framework directly, a very common pattern in Ember applications was to import this package as the Ember global object and subclass from there as needed:

import Ember from 'ember';
export default Ember.Component.extend({
  // this is the old way

With the introduction of the Ember JavaScript Modules API, specific Ember modules may now be imported directly through the use of scoped packages. For example module import and exports can now look like this:

import Component from '@ember/component';
export default Component.extend({
  // this is the current way

Making use of the JavaScript Modules API 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