Skip to content

Instantly share code, notes, and snippets.

@anvyst
Created August 22, 2016 14:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anvyst/710b9ef8752941a711e35cc345c28b57 to your computer and use it in GitHub Desktop.
Save anvyst/710b9ef8752941a711e35cc345c28b57 to your computer and use it in GitHub Desktop.
Using JCF options in multiple Select elements with Ember
{{#x-select class='input2-style' name='country' value=countryValue id='input2-select' }}
{{#each-in countries as |code country|}}
{{#x-option value=code}} {{country}} {{/x-option}}
{{/each-in}}
{{/x-select}}
import Ember from 'ember';
export default Ember.Component.extend({
classNames: ['input2','country-list'],
didRender() {
Ember.run.later(function(){
jcf.replace('#input2-select','Select');
})
}
});
import Ember from 'ember';
export default Ember.Component.extend({
/* it re-initiates the custom element after render */
didRender() {
jcf.replace('#currency-options','Select', {
"wrapNative": false,
"wrapNativeOnMobile": true
});
},
actions: {
update(value) {
Ember.Logger.info("currency changed to " + value);
}
}
});
{#x-select value=currency class='light' id='currency-options' action='update'}}
{{#x-option value='usd'}}USD{{/x-option}}
{{#x-option value='eur'}}EUR{{/x-option}}
{{#x-option value='rub'}}RUB{{/x-option}}
{{/x-select}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment