Skip to content

Instantly share code, notes, and snippets.

@maxkwallace
Created November 27, 2015 13:02
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 maxkwallace/46c4ce256383181b9570 to your computer and use it in GitHub Desktop.
Save maxkwallace/46c4ce256383181b9570 to your computer and use it in GitHub Desktop.
How to use ember select for static dropdown?
import Ember from 'ember';
export default Ember.Controller.extend({
appName:'Ember Twiddle',
actions: {
setType: function (type) {
console.log('called with type: ' + type.toString());
this.set('type', type);
console.log('type is now: ' + this.get('type'));
}
},
});
<h1>Welcome to {{appName}}</h1>
<br>
<br>
<select onchange={{action 'setType' value="target.value"}}>
<option value="0">Choice 1</option>
<option value="1">Choice 2</option>
</select>
{{outlet}}
<br>
<br>
{
"version": "0.4.16",
"EmberENV": {
"FEATURES": {}
},
"dependencies": {
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js",
"ember": "1.13.10",
"ember-data": "https://cdnjs.cloudflare.com/ajax/libs/ember-data.js/2.1.0/ember-data.js",
"ember-template-compiler": "1.13.10"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment