Skip to content

Instantly share code, notes, and snippets.

@ef4
Created August 9, 2015 17:54
Show Gist options
  • Select an option

  • Save ef4/f86713ce6136fca513f0 to your computer and use it in GitHub Desktop.

Select an option

Save ef4/f86713ce6136fca513f0 to your computer and use it in GitHub Desktop.
New Twiddle
import Ember from 'ember';
export default Ember.Helper.helper(function equalHelper(params) {
return params[0] === params[1];
});
import Ember from 'ember';
export default Ember.Controller.extend({
choices: ['red', 'green', 'blue'],
value: 'red'
});
<h2>Choices</h2>
<select onchange={{action (mut value) value="target.value"}}>
{{#each choices as |choice|}}
<option value={{choice}} selected={{is-equal value choice}}>{{choice}}</option>
{{/each}}
</select>
<h2>Selected Value</h2>
{{value}}
{
"version": "0.4.7",
"dependencies": {
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js",
"ember": "https://cdnjs.cloudflare.com/ajax/libs/ember.js/1.13.6/ember.js",
"ember-data": "https://cdnjs.cloudflare.com/ajax/libs/ember-data.js/1.13.7/ember-data.js",
"ember-template-compiler": "https://cdnjs.cloudflare.com/ajax/libs/ember.js/1.13.6/ember-template-compiler.js"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment