Let’s Learn Ember – The Ember Object Model

In this post, I will delve into the Ember Object model.

Ember has adopted more of an object-oriented model unlike Javascript. The Ember.Object is the main class for all the Ember objects from which all the almost every object in Ember.js is derived. This Ember.Object is the basis for creating all the views, controllers, models and the application itself. Consequently, all the objects share the same core capabilities as they all have been derived from a same object.


Now let’s create a new object in Ember. For that, we just need to use the function create() of Ember.Object class as shown below.


If an object literal is passed to the create() method (which is totally optional), then it is defined as the properties on that instantiated object. In the above example, we have defined a property called “message” and passed it value “Hello World”. Even though, we are just creating a simple Ember object with a single defined property, if we look up this object “emberObject” in the browser console, we can see that there is a lot more going on behind the scenes. Continue reading