Created
October 19, 2015 12:34
-
-
Save sly7-7/95cac8de902275d6f8d4 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'; | |
var array = [{id: 42, name: 'blah'}, | |
{id: 43, name: 'oh'}, | |
{id: 44, name: 'ah'}]; | |
export default Ember.Controller.extend({ | |
appName:'Ember Twiddle', | |
someProp: true, | |
//things: [42,43, 44], | |
things: [{id: 42, name: 'blah'}, | |
{id: 43, name: 'oh'}, | |
{id: 44, name: 'ah'}], | |
sortedThings: Ember.computed('someProp', function() { | |
var someProp = this.get('someProp'); | |
console.log(this.get('things')); | |
return this.get('things').sort(function(a,b) { | |
return someProp === true ? a.id-b.id : b.id-a.id; | |
}); | |
}), | |
actions: { | |
changeThing: function() { | |
this.toggleProperty('someProp'); | |
} | |
} | |
}); |
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({ | |
}); |
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.4.13", | |
"dependencies": { | |
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js", | |
"ember": "https://cdnjs.cloudflare.com/ajax/libs/ember.js/2.1.0/ember.debug.js", | |
"ember-data": "https://cdnjs.cloudflare.com/ajax/libs/ember-data.js/1.13.13/ember-data.js", | |
"ember-template-compiler": "https://cdnjs.cloudflare.com/ajax/libs/ember.js/2.1.0/ember-template-compiler.js" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment