Skip to content

Instantly share code, notes, and snippets.

@SaladFork
Created June 1, 2016 18:47
Show Gist options
  • Save SaladFork/73720620c46766441c348bfef2522b8a to your computer and use it in GitHub Desktop.
Save SaladFork/73720620c46766441c348bfef2522b8a to your computer and use it in GitHub Desktop.
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
colors: [
'red',
'green',
'blue'
],
selectedColor: null,
actions: {
selectColor(color) {
console.log(color);
this.set('selectedColor', color);
}
}
});
Colors:
<select onchange={{action 'selectColor' value='target.value'}}>
{{#each colors as |color|}}
<option value={{color}}>{{color}}</option>
{{/each}}
</select>
Selected: {{selectedColor}}
{
"version": "0.8.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.5.1",
"ember-data": "2.5.2",
"ember-template-compiler": "2.5.1"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment