Last active
March 11, 2016 17:59
-
-
Save courtneyphillips/f48abb4ee2c2f03053bc to your computer and use it in GitHub Desktop.
Using .intersect functionality of Ember Computed Properties in component
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.Component.extend({ | |
selectedSkills: Ember.inject.service(), // <-- service containing an array of objects. | |
selected: Ember.computed.alias('selectedSkills.skills'), // <-- giving 'selected' nickname to this array of objects within service. | |
skillsInCommon: Ember.computed.intersect('selected', 'project.skills'), // <-- returning only the objects present in both the service's array and in 'project.skills' (current model where this component is being called?) | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment