Skip to content

Instantly share code, notes, and snippets.

@greyhwndz
greyhwndz / application.controller.js
Last active August 28, 2015 09:51
Components - Sending Actions to Application
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Components - Sending an Action to Application',
appMessage: '',
actions: {
greet(message) {
this.set('appMessage', message);
}
}
@greyhwndz
greyhwndz / application.controller.js
Created August 28, 2015 10:00
Components - Simple and Block Form
import Ember from 'ember';
export default Ember.Controller.extend({
appName:'Components - Simple and Block Form'
});
@greyhwndz
greyhwndz / application.controller.js
Last active August 28, 2015 10:36
Components - Detecting Block Params
import Ember from 'ember';
export default Ember.Controller.extend({
});
@greyhwndz
greyhwndz / future-proof.md
Last active August 30, 2015 04:35 — forked from samselikoff/future-proof.md
Future-proofing your Ember 1.x code

This post is also on my blog, since Gist doesn't support @ notifications.


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 as normal properties on your top-level controller. Export an Ember.Controller, otherwise a proxy will be generated. You can use Ember.RSVP.hash to simulate setting normal props on your controller.
@greyhwndz
greyhwndz / actions-yo.component.js
Last active August 31, 2015 04:47 — forked from KTKate/actions-yo.component.js
Component - Closure Actions
import Ember from 'ember';
export default Ember.Component.extend({
actions: {
doIt(msg){
this.sendAction('theAction', msg);
}
}
});
@greyhwndz
greyhwndz / ember-data-1.13-cheatsheet.md
Last active August 31, 2015 12:26 — forked from jeremywrowe/ember-data-1.13-cheatsheet.md
Ember Data v1.13.x Cheatsheet

Ember Data v1.13.x Cheatsheet

Things to remember

  • If you return a promise beforeModel, model, and afterModel in a route, it will wait to resolve the promise before transitioning into the route. This is helpful when using loading and error substate templates.

  • All ember data records go into a global cache. There is not a cache per query,

@greyhwndz
greyhwndz / ember_examples.md
Last active August 31, 2015 16:47 — forked from rwjblue/ember_examples.md
Ember Examples
@greyhwndz
greyhwndz / ember-config-environment.js
Last active August 31, 2015 18:44 — forked from jhliberty/ember-config-environment.js
Basic JWT Auth for Seeds.js/Sane Stack (aka Ember on Sails)
var ENV = {
modulePrefix: 'frontend',
environment: environment,
baseURL: '/',
locationType: 'auto',
EmberENV: {
FEATURES: {
// Here you can enable experimental features on an ember canary build
// e.g. 'with-controller': true
}
import Ember from 'ember';
export default Ember.Controller.extend({
airplaneMode: false,
wifi: true,
bluetooth: true,
actions: {
setAirplaneMode(value) {
if (value) {
# Usage:
# 
# post.serialize(include: ['comments'], comments: {include: ['author']})
#
# gives:
# {
#   data: {
#     attributes: {id: 1, name: 'post name'},
#     relationships: {