Created
November 13, 2015 21:07
-
-
Save anulman/a5fc6a33988c0858358f to your computer and use it in GitHub Desktop.
Ember dropdown 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
// app/components/dropdown-select/component.js | |
import Ember from 'ember'; | |
const { | |
Component, | |
computed | |
} = Ember; | |
export default Component.extend({ | |
// public api | |
content: [], | |
prompt: 'select...', | |
isDropped: false, | |
selectedItem: null, | |
hasSelectedItem: computed.bool('selectedItem'), | |
actions: { | |
toggleDropped() { | |
this.toggleProperty('isDropped'); | |
}, | |
selectItem(item) { | |
this.set('selectedItem', item); | |
this.sendAction('selectItem', item); | |
} | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment