Created
April 25, 2018 00:00
-
-
Save GCheung55/6253feadb577d2c7b5c7935d548796db to your computer and use it in GitHub Desktop.
Demonstrate multiple select
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({ | |
optionDefaults: Ember.computed(function() { | |
return ['foofoo', 'barbar', 'bazbaz']; | |
}), | |
optionsSelected: Ember.computed(function() { | |
return []; | |
}), | |
selectOptions: Ember.computed('optionsSelected', function() { | |
const optionsSelected = this.get('optionsSelected'); | |
const optionDefaults = this.get('optionDefaults'); | |
return optionDefaults.map((option) => { | |
const isSelected = optionsSelected.includes(option); | |
return { | |
name: option, | |
value: option, | |
isSelected | |
} | |
}); | |
}), | |
actions: { | |
onChange() { | |
console.log(arguments); | |
} | |
} | |
}); |
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({ | |
appName: 'Ember Twiddle' | |
}); |
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.13.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": "2.16.2", | |
"ember-template-compiler": "2.16.2", | |
"ember-testing": "2.16.2" | |
}, | |
"addons": { | |
"ember-data": "2.16.3" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment