Last active
January 18, 2017 13:53
-
-
Save benbabics/1d54d741b9f0b69b971cd6d96ed0c2a6 to your computer and use it in GitHub Desktop.
checkbox-all-valid-items
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({ | |
defaultAllChecked: false, | |
allValidItems: Ember.computed.oneWay( 'defaultAllChecked' ), | |
isAllChecked: Ember.computed('allValidItems', 'items.[]', function() { | |
return this.get('allValidItems.length') === this.get('items.length'); | |
}) | |
}); |
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
console.clear(); | |
import Ember from 'ember'; | |
export default Ember.Controller.extend({ | |
appName: 'Ember Twiddle', | |
allValidItems: Ember.computed('[email protected]', function() { | |
return this.get( 'collection' ).filter(function(item) { | |
return item.get( 'isValid' ); | |
}); | |
}), | |
collection: Em.A([ | |
Em.Object.create({ name: 'foo', isValid: true }), | |
Em.Object.create({ name: 'bar', isValid: false }), | |
Em.Object.create({ name: 'baz', isValid: 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.10.7", | |
"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.0", | |
"ember-data": "2.10.0", | |
"ember-template-compiler": "2.10.0", | |
"ember-testing": "2.10.0" | |
}, | |
"addons": {} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment