Skip to content

Instantly share code, notes, and snippets.

@stevekinney
Created August 20, 2014 17:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stevekinney/7ffd68b35b98ee6b919d to your computer and use it in GitHub Desktop.
Save stevekinney/7ffd68b35b98ee6b919d to your computer and use it in GitHub Desktop.
Ember Tasting Notes

Notable features of Ember

The Router

Ember has a super powerful router and the framework strongly emphasizes the importance of URLs. Some other JavaScript frameworks don't update the URL to reflect the current state of the app, this means that the back button doesn't work.

The Object Model

Ember brings in it's own class-based inheritance system with support for super and other goodies.

The Ember object model also has support for computed properties, which are super cool. Computed properties are dynamically generated from other properties in the object.

var Person = Ember.Object.extend({

  firstName: 'Steve',
  lastName: 'Kinney',

  fullName: function () {
    return this.get('firstName') + ' ' + this.get('lastName');
  }.property('firstName', 'lastName')

});

If either first name or last name changes, the fullName computed property is recomputed. The other really cool thing is that if both firstName and lastName changes, fullName is still only recomputed once because Ember is smart enough to wait until the event loop completes before recomputing everything.

Two-way Data Binding

If something changes in your model or controller, it's instantly reflected in the browser. If something changes in the DOM, it's instantly reflected in your model or controller. Pretty awesome.

Web Components

Web components are custom HTML elements that encapsulate functionality and appearance. Their coming to the HTML spec, but you can use them now in Ember.

http://emberjs.com/guides/components/

Toolchain

The Ember team is focused on creating a great experience for developers. ember-cli gives you a full toolchain for creating Ember apps easily. Just type ember new in the command line. ember-cli also allows you to generate models and controllers, just like in Rails. Additionally, it let's you use ES6 features like classes and modules in a way that compiles down to JS that is compatible as far back as IE6!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment