Skip to content

Instantly share code, notes, and snippets.

@kavitshah8
Forked from samselikoff/future-proof.md
Last active August 29, 2015 14:09
Show Gist options
  • Save kavitshah8/5ffc27176cc8db71edc2 to your computer and use it in GitHub Desktop.
Save kavitshah8/5ffc27176cc8db71edc2 to your computer and use it in GitHub Desktop.

Components are taking center stage in Ember 2.0. Here are some things you can do today to make the transition as smooth as possible:

  • In general, replace views + controllers with components

  • Only use controllers at the route level, and use Ember.Controller instead of Ember.ArrayController or Ember.ObjectController

    • Stay away from things like ItemControllers and calls to render(). Use components instead.
  • Don't use views

  • Use Ember CLI

  • Write your app in the "data down, actions up" paradigm

    • Not enforced, but you can still structure your app this way
    • Stay away from two-way bindings and mutability
  • Don't use each or with in the context-switching form. That is, use

     {{#each user in users}} {{user.firstName}} {{/each}}
    

    instead of

     {{#each users}} {{firstName}} {{/each}}
    
  • Use this.route instead of this.resource in Router.map

  • More intutive attribut binding. You would expect to be able type something like:

    <a href="{{url}}">Click here</a>
    

instead of <a {{bind-attr href=url}}>Click here</a>

Better apps

Follow these tips, and your apps will be ready for Ember 2.0. You'll also learn a lot about writing apps that are better structured and easier to understand!

Deprecations will be coming to help you move towards these newer practices. The goal is, if your app runs on the final version of 1.x with no deprecations, it should be able to run in 2.0.

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