On Github alvincrespo / ember-architecture
Created by Alvin Crespo / @alvincrespo
Ember is a JavaScript framework that aims to help developers create "ambitious web applications" that are scalable, performant and accessible.
Oh hey, these are some notes. They'll be hidden in your presentation, but you can see them if you open the speaker notes window (hit 's' on your keyboard).There are more: http://todomvc.com/
Where your code should be placed is clear.
You shouldn't have to write and maintain much code.
Changing code doesn't affect the whole application.
Ember provides an architecture for managing an applications data model, logic and view presentation independently.
export Ember.Router.map({ this.resource('assessments'); });
Ember creates and does a lookup on the following:
App.AssessmentsRoute = Ember.Route.extend();
App.AssessmentsController = Ember.Controller.extend();
App.AssessmentsView = Ember.View.extend();
Routes handle the communication for retrieving a model:
// app/scripts/routes/assessments.js export Ember.Route.extend({ model: function() { // Hooking into our API's return $.ajax({ url: 'http://localhost:8888/assessments' }); } });Specifying a Routes Model
// app/scripts/controllers/assessments.js export Ember.Controller.extend({ // A computed property that observes the models `name` property // and returns the an uppercase version of the name title: function() { return this.get('model.name').toUpperCase(); }.property('model.name') });Associated Template
<section class="assessment"> <header> <h1>{{title}}</h1> </header> </section>Decorating the Model with Controllers
// app/scripts/views/assessments.js export Ember.View.extend({ templateName: 'assessments/index.hbs', click: function(){ // Handle a click event here } });
User interaction is contained in your view. Associated templates can be defined here as well.
Handling user initiated eventsYou should be using Ember.js because you get all of the following for free: