The Ember MVC

Model, View, Controller. That spells M V C.

The model is where the data is kept. It’s the blueprint. For example: Model describes a Person. A Person has a name and an age. In Ember.js we create a model like this.

App.Person = Ember.Object.extend({
  name: null,
  age: null
});

The view is the visual layer. It’s what you see and interact with. A form, a bullet list etc. To define a view type:

App.PersonView = Ember.View.extend();

And last but not least the controller. The controller is the bridge between the model and the view. When someone, for example, clicks a button the controller gets input from the view and preforms actions on the model (CRUD).

App.PersonController = Ember.Controller.extend();

In the controller the information about your (in this case) Person(s) will be stored.

And that wraps it up for this time.

2 Replies to “The Ember MVC”

Comments are closed.