Skip to content

Instantly share code, notes, and snippets.

View kavitshah8's full-sized avatar

Kavit Shah kavitshah8

  • Adobe
  • Bay Area, CA
View GitHub Profile

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

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:

  • Use Ember CLI

  • In general, replace views + controllers with components

  • Only use controllers at the top-level for receiving data from the route, and use Ember.Controller instead of Ember.ArrayController or Ember.ObjectController

  • Fetch data in your route, and set it on attrs on your top-level controller:

    ```js   
    //controllers/index.js
    import Ember from 'ember';
    
Promise.resolve().then(function () {
return 100;
})
.then(function() {
console.log(arguments);
});
// ---
Promise.resolve(200).then(function () {