Last active
September 10, 2018 19:02
-
-
Save danmeyers/8ac620ff4fb419e8692e4a064163e552 to your computer and use it in GitHub Desktop.
Intermediate property
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({ | |
| mockObjects: [ | |
| { | |
| 'k': { | |
| 'e': 3 | |
| } | |
| }, | |
| { | |
| 'k': { | |
| 'e': 5 | |
| } | |
| } | |
| ], | |
| appName: 'Ember Twiddle', | |
| mockObjStr: Ember.computed('mockObjects', function() { | |
| return JSON.stringify(this.mockObjects); | |
| }), | |
| depOne: Ember.computed.filter('mockObjects.@each.k', obj => obj.k.e > 0), | |
| depOneStr: Ember.computed('depOne', function() { | |
| return JSON.stringify(this.depOne); | |
| }), | |
| mockObjKs: Ember.computed.mapBy('mockObjects', 'k'), | |
| depTwo: Ember.computed('mockObjKs.@each.e', function() { | |
| return JSON.stringify(this.mockObjKs); | |
| }), | |
| depThree: Ember.computed('mockObjects.@each.k', 'mockObjKs.@each.e', function() { | |
| // Uncomment this one: | |
| const getDepTwo = this.get('mockObjKs'); | |
| return JSON.stringify(this.mockObjects.filter(obj => obj.k.e > 0)); | |
| }), | |
| actions: { | |
| updateThing() { | |
| const a = this.mockObjects[0]; | |
| Ember.set(a, 'k.e', 0); | |
| } | |
| } | |
| }); |
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.15.0", | |
| "EmberENV": { | |
| "FEATURES": {} | |
| }, | |
| "options": { | |
| "use_pods": false, | |
| "enable-testing": false | |
| }, | |
| "dependencies": { | |
| "jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.js", | |
| "ember": "3.2.2", | |
| "ember-template-compiler": "3.2.2", | |
| "ember-testing": "3.2.2" | |
| }, | |
| "addons": { | |
| "ember-data": "3.2.0" | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment