O'Reilly logo

Mastering Ember.js by Mitchel Kelonye

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Object and array controllers

Ember.js ships with the following controllers that are meant to easily represent objects and enumerable data, respectively:

  • Object controller
  • Array controller

These controllers are a bit different from the other controllers in the sense that the data being represented is usually set as the model property of the controller, for example:

Ember.ObjectController.create({
  model: {
    name: 'Jon Doe'
    age: 23
  }
});

Ember.ArrayController.create({
  model: [1, 2]
});

An object controller

An object controller is used to proxy properties of the object being represented. This means that if a controller property is accessed, Ember.js will look for the property first in the controller, and then the model. For example, let's create a post model ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required