home
  • Blog
3.4
  • Getting Started
  • Tutorial
  • The Object Model
    • Objects in Ember
    • Classes and Instances
    • Reopening Classes and Instances
    • Computed Properties
    • Computed Properties and Aggregate Data
    • Observers
    • Bindings
    • Enumerables
  • Routing
  • Templates
  • Components
  • Controllers
  • Models
  • Application Concerns
  • Testing
  • Ember Inspector
  • Addons and Dependencies
  • Configuring Ember.js
  • Contributing to Ember.js
  • Glossary
Old Guides - You are viewing the guides for Ember v3.4.0.
Go to v5.0.0

Objects in Ember

Edit pencil

One of the first things you'll notice when you generate JavaScript files in Ember is that most of the code you will write goes inside of an object. While an Ember Object might look a lot like an ES2015 JavaScript class, it has some special properties.

Introducing: Ember Objects

The Ember Object class extends plain JavaScript objects to provide core framework functions such as participating in Ember's binding system or how changes to an object automatically trigger updates to the user interface.

Most objects in Ember, including Routes, Models, Services, Mixins, Controllers, and Components extend the EmberObject class.

Why Ember Objects?

The most important reason is that an Ember Object can be watched for changes – or observed. For example, being observable is important for computed properties. It is one of the fundamental ways that models, controllers and views communicate with each other in an Ember application.

More on Ember Objects

The @ember/object package also provides a class system, supporting features like mixins and constructor methods, and being observable.

Some features in Ember's object model are not present in JavaScript classes or common patterns, but all are aligned as much as possible with the language and proposed additions.

Ember also extends the JavaScript Array prototype with its @ember/enumerable interface to provide change observation for arrays.

Finally, Ember extends the String prototype with a few formatting and localization methods.

left arrow
Deploying
Classes and Instances
right arrow
On this page

  • Introducing: Ember Objects
  • Why Ember Objects?
  • More on Ember Objects
Team Sponsors Security Legal Branding Community Guidelines
Twitter GitHub Discord Mastodon

If you want help you can contact us by email, open an issue, or get realtime help by joining the Ember Discord.

© Copyright 2023 - Tilde Inc.
Ember.js is free, open source and always will be.


Ember is generously supported by
blue