Last active
December 21, 2017 10:25
-
-
Save 3gwebtrain/73acd0ff6530dbe5a5725876f120fb59 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', | |
| sortByAmountSpent:Ember.computed.sort('model', function(a,b){ | |
| var ap = parseInt(Ember.get(a, 'amount')), | |
| bp = parseInt( Ember.get(b, 'amount')); | |
| console.log("ap", typeof ap, "bp", typeof bp); | |
| if(ap !== bp) { | |
| return bp - ap; | |
| } | |
| }), | |
| sortByDateOfPurchase:Ember.computed.sort('model', 'sortingAmout') | |
| ,actions:{ | |
| sortByAmount:function(){ | |
| this.set("model", this.get('sortByAmountSpent')); | |
| }, | |
| sortByDate:function(){ | |
| this.set("model", this.get('sortByDateOfPurchase')); | |
| }, | |
| } | |
| }); |
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 [{"amount":"8733.00","date-of-purchase": "22/12/2017"},{"amount":"877.00","date-of-purchase": "22/11/2017"},{"amount":"8212.00","date-of-purchase": "22/9/2017"},{"amount":"7765.00","date-of-purchase": "22/10/2017"},{"amount":"778.00","date-of-purchase": "22/10/2016"}] | |
| } | |
| }); |
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.12.1", | |
| "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.12.0", | |
| "ember-template-compiler": "2.12.0", | |
| "ember-testing": "2.12.0" | |
| }, | |
| "addons": { | |
| "ember-data": "2.12.1" | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment