EmberJS - Object Model



In Ember.js, all objects are derived from the Ember.Object. Object-oriented analysis and design technique is called object modeling. The Ember.Object supports features such as mixins and constructor methods by using the class system. Ember uses the Ember.Enumerable interface to extend the JavaScript Array prototype to give the observation changes for arrays and also uses the formatting and localization methods to extend the String prototype.

The following table lists down the different types of object model in Ember.js along with their description −

S.No. Types & Description
1 Classes and Instances

Class is a template or blue print, that has a collection of variables and functions, whereas instances are related to the object of that class. You can create new Ember class by using the Ember.Object's extend() method.

2 Reopening Classes and Instances

This is nothing but updating the class implementation without redefining it.

3 Computed Properties

A computed property declares functions as properties and Ember.js automatically calls the computed properties when needed and combines one or more properties in one variable.

4 Computed Properties and Aggregate Data

The computed property accesses all items in an array to determine its value.

5 Observers

The observer observes the property such as computed properties and updates the text of the computed property.

6 Bindings

The binding is a powerful feature of Ember.js which helps to create a link between two properties and if one of the properties gets changed, the other one is updated automatically.

Advertisements