-
-
Save rwjblue/c212fc6f3364e67cb178b51bb7fa1537 to your computer and use it in GitHub Desktop.
ember-bug-multi-brace-plus-arrayproxy
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({ | |
items: [ | |
{ id: 1, test: true, cat: 1}, | |
{ id: 2, test: true, cat: 2}, | |
{ id: 3, test: true, cat: 3}, | |
{ id: 4, test: true, cat: 4}, | |
{ id: 5, test: false, cat: 1}, | |
{ id: 6, test: false, cat: 2}, | |
{ id: 7, test: false, cat: 3}, | |
{ id: 8, test: false, cat: 4}, | |
], | |
testFilter: false, | |
filtered: Ember.computed('testFilter', '[email protected]', function() { | |
let result = this.get('items'); | |
if (this.get('testFilter')) { | |
result = result.filterBy('test'); | |
} | |
return result; | |
}), | |
multiEach: Ember.computed('filtered.@each.{cat,id}', function() { | |
return this.get('filtered').filter((item) => (item.id + item.cat) % 2 == 0); | |
}), | |
correct: Ember.computed.alias('multiEach'), | |
bugged: Ember.computed(function() { | |
return Ember.ArrayProxy.extend({parent: this, content: Ember.computed.alias('parent.multiEach')}).create(); | |
}), | |
}); |
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": "canary", | |
"ember-template-compiler": "canary", | |
"ember-testing": "canary" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment