Skip to content

Instantly share code, notes, and snippets.

@ahmetemrekilinc
Created September 26, 2019 06:25
Show Gist options
  • Save ahmetemrekilinc/e11356c3f7e4763076ae98101bf3aabf to your computer and use it in GitHub Desktop.
Save ahmetemrekilinc/e11356c3f7e4763076ae98101bf3aabf to your computer and use it in GitHub Desktop.
ember-select-example
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
value: 'Hardcover',
actions: {
updateValue(event){
console.log(event.target.value);
this.set('value', event.target.value);
}
}
});
<h1>Welcome to {{appName}}</h1>
<br>
<select id="format" onchange={{action 'updateValue'}}>
<option value=""></option>
<option value="Paperback" selected={{eq value "Paperback"}} >Paperback</option>
<option value="Hardcover" selected={{eq value "Hardcover"}} >Hardcover</option>
<option value="E-Book" selected={{eq value "E-Book"}}>E-Book</option>
</select>
{
"version": "0.15.1",
"EmberENV": {
"FEATURES": {}
},
"options": {
"use_pods": false,
"enable-testing": false
},
"dependencies": {
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.js",
"ember": "3.4.3",
"ember-template-compiler": "3.4.3",
"ember-testing": "3.4.3"
},
"addons": {
"ember-data": "3.4.2",
"ember-truth-helpers": "2.1.0"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment