Created
May 9, 2016 21:28
-
-
Save krisselden/76993da868d5d5df1f6624bea5ac8b07 to your computer and use it in GitHub Desktop.
New Twiddle
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
export default Ember.Controller.extend({ | |
appName: 'Ember Twiddle' | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
const ORANGE = { | |
id: '6aefd2842be62cd470709b27aedc7db7', | |
name: 'Orange' | |
}; | |
const BANANA = { | |
id: 'df3e129a722a865cc3539b4e69507bad', | |
name: 'Banana' | |
}; | |
const APPLE = { | |
id: '30c6677b833454ad2df762d3c98d2409', | |
name: 'Apple' | |
}; | |
const MODEL = { | |
fruits: [ | |
ORANGE, | |
APPLE, | |
BANANA | |
] | |
}; | |
export default Ember.Route.extend({ | |
model() { | |
console.log('here'); | |
Ember.run.schedule('afterRender', () => { | |
// pollute rendering with ids to show item is const with key | |
MODEL.fruits.forEach(fruit => { | |
document.getElementById(fruit.id).textContent = fruit.id; | |
}); | |
}); | |
return MODEL; | |
} | |
}); | |
setInterval(() => { | |
let first = MODEL.fruits[0]; | |
let last = MODEL.fruits[2]; | |
Ember.set(MODEL, 'fruits', [last, APPLE, first]); | |
}, 1000); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"version": "0.8.0", | |
"EmberENV": { | |
"FEATURES": {} | |
}, | |
"options": { | |
"use_pods": false, | |
"enable-testing": false | |
}, | |
"dependencies": { | |
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js", | |
"ember": "2.5.1", | |
"ember-data": "2.5.2", | |
"ember-template-compiler": "2.5.1" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment