SproutCore → SproutCore 2 → Amber → Ember.js
According to the Ember.js website, Ember is "A framework for creating ambitious web applications"
The API has been going through a lot of fluctuations and with the release of version 1 approaching, things have become more stable. I also believe this has translated to some book deals and a peepcode video.
I also noticed that the announcement of Discource by Jeff Atwood and the fact that it was using ember.js seemed like a big deal.
App = Ember.Application.create({});
...
App.IndexRoute = Ember.Route.extend({
redirect: function () {
this.transitionTo('shelves');
}
});
App = Ember.Application.create({});
...
App.ShelvesController = Ember.ArrayController.extend({
content: [],
needs: ["shelf"],
addBook: function (book) {
console.log("Adding a Book!");
var shelf = this.get("controllers.shelf").get('model'), books = shelf.get('books');
books.createRecord(book);
}
});
App.Shelf = DS.Model.extend({
books: DS.hasMany('App.Book'),
category: DS.attr('string')
});
App = Ember.Application.create({});
...
App.ShelfView = Ember.View.extend({
layoutName: 'shelfListLayout',
templateName: 'shelf'
});
App.Store = DS.Store.extend({
revision: 11,
adapter: 'DS.FixtureAdapter'
});
Ember has a couple of dependencies: jQuery and Handlebars
A couple of quick ways to get started include:
cd ~/projects/books
ember create ember-books
ember-generate --scaffold book title:string author:string published:number
ember build
open ember-books/index.html
Example App(s) provided in Github