Last active
March 18, 2016 19:48
-
-
Save SirZach/7cf7e5465a5bcfe61bb3 to your computer and use it in GitHub Desktop.
Shifting Test
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', | |
actions: { | |
swapByShift() { | |
let objs = this.get('model'); | |
let first = objs.shiftObject(); | |
let second = objs.shiftObject(); | |
objs.unshiftObjects([second, first]); | |
}, | |
swapByReplace() { | |
let objs = this.get('model'); | |
let first = objs.objectAt(0); | |
let second = objs.objectAt(1); | |
objs.replace(0, 1, second); | |
objs.replace(1, 1, first); | |
} | |
} | |
}); |
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.Route.extend({ | |
model() { | |
return [ | |
{ name: 'a' }, | |
{ name: 'b' }, | |
{ name: 'c' } | |
] | |
} | |
}); |
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.Component.extend({ | |
didInsertElement() { | |
this._super(...arguments); | |
let name = this.get('name'); | |
console.log(`${name} was just inserted`); | |
} | |
}); |
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.6.5", | |
"EmberENV": { | |
"FEATURES": {} | |
}, | |
"options": { | |
"enable-testing": false | |
}, | |
"dependencies": { | |
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js", | |
"ember": "1.12.2", | |
"ember-data": "https://cdnjs.cloudflare.com/ajax/libs/ember-data.js/2.4.0/ember-data.js", | |
"ember-template-compiler": "1.12.2" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment