Skip to content

Instantly share code, notes, and snippets.

@stefanpenner
Last active August 29, 2015 14:24
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 stefanpenner/ffc27c280d9de174e09b to your computer and use it in GitHub Desktop.
Save stefanpenner/ffc27c280d9de174e09b to your computer and use it in GitHub Desktop.
component-less-helpers
export default Ember.Controller.extend({
actions: {
changed(val) {
this.set('currentValue', val);
console.log(val);
}
}
});
export default function equalHelper(params) {
return params[0] === params[1];
}
{{currentValue}}
<input type="range"
value={{currentValue}}
min=1
max=10
oninput={{action "changed" value="target.value"}} >
<input type="checkbox"
value={{currentValue}}
min=1
max=10
onchange={{action "changed" value="target.checked"}} >
<input type="text"
value={{currentValue}}
min=1
max=10
oninput={{action "changed" value="target.value"}} >
<form action="" onchange={{action "changed" value="target.value"}} >
<input type="radio"
name="person"
checked={{is-equal currentValue "friend"}}
value="friend">friend
<input type="radio"
name="person"
value="foe"
checked={{is-equal currentValue "foe"}}>
foe
</form>
{{currentValue}}
<select onchange={{action "changed" value="target.value"}}>
{{#each model.choices key="@identity" as |choice|}}
<option value={{choice}} selected={{is-equal currentValue choice}}>{{choice}}</option>
{{/each}}
</select>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment