Last active
February 15, 2017 14:44
-
-
Save lvl99/0ee040408f09e2288fc64dc8d4430094 to your computer and use it in GitHub Desktop.
New Twiddle
This file contains 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({ | |
filteredItems: Ember.computed('items', function () { | |
// Imagine more than just one filter here | |
return this.get('items').filterBy('showMe', true) | |
}), | |
sortDirection: ['lastUpdated:desc', 'createdAt:desc'], | |
sortedItems: Ember.computed.sort('filteredItems', 'sortDirection'), | |
afterSortedItems: Ember.computed('sortedItems', function () { | |
// Doesn't get triggered! | |
console.log('Sorted items', this.get('sortedItems')) | |
return this.get('sortedItems') | |
}) | |
}); |
This file contains 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 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'; | |
import config from './config/environment'; | |
const Router = Ember.Router.extend({ | |
location: 'none', | |
rootURL: config.rootURL | |
}); | |
Router.map(function() { | |
}); | |
export default Router; |
This file contains 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 () { | |
let now = new Date() | |
return [{ | |
id: 1, | |
name: 'This is a test', | |
createdAt: now.setTime(now.getTime() + 3600), | |
lastUpdated: now.setTime(now.getTime() + 3600), | |
showMe: true | |
},{ | |
id: 2, | |
name: 'This is another test (not seen)', | |
createdAt: now.setTime(now.getTime() + 3600), | |
lastUpdated: now.setTime(now.getTime() + 3600), | |
showMe: false | |
},{ | |
id: 3, | |
name: 'This is one last test', | |
createdAt: now.setTime(now.getTime() + 3600), | |
lastUpdated: now.setTime(now.getTime() + 3600), | |
showMe: true | |
},{ | |
id: 4, | |
name: 'Actually this is the last test', | |
createdAt: now.setTime(now.getTime() + 3600), | |
lastUpdated: now.setTime(now.getTime() + 3600), | |
showMe: true | |
}] | |
} | |
}); |
This file contains 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.11.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.10.2", | |
"ember-data": "2.11.0", | |
"ember-template-compiler": "2.10.2", | |
"ember-testing": "2.10.2" | |
}, | |
"addons": {} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment