Understanding Ember.js
Before we continue with the actual coding of our small application, we will go through the most important components of Ember.js.
Exploring classes and objects in Ember.js
Like every framework, Ember.js has predefined objects and classes, which are at our disposal. In most cases, we will extend them and write only the custom logic, which is a part of your application. All the ready-to-use classes are under the Ember
namespace. This means that whenever we want to use some part of the framework, we need to go through the Ember.
notation. For example, in the class extending shown in the following code:
App.Person = Ember.Object.extend({ firstname: '', lastname: '', hi: function() { var name = this.get("firstname") + " " + this.get("lastname"); alert("Hello, my name is " + name); } }); var person = App.Person.create(); person.set("firstname", "John"); person.set("lastname", "Black"); person.hi();
We defined a class called Person
. It has two properties and only...