Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Normal Checkbox
import Ember from 'ember';
export default Ember.Component.extend({
actions: {
inputChanged(value) {
if (typeof this.onchange === 'function') {
this.onchange(value);
}
console.log(value);
}
}
});
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
import Ember from 'ember';
export function not([val]/*, hash*/) {
return !val;
}
export default Ember.Helper.helper(not);
<h1>Welcome to {{appName}}</h1>
<br>
<br>
{{my-component value=val
change=(action (mut val) (not val))}}
<br>
<br>
<input type="checkbox" checked={{value}} onchange={{action "inputChanged" value="target.value"}}>
{{value}}
{
"version": "0.10.6",
"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.9.0",
"ember-data": "2.9.0",
"ember-template-compiler": "2.9.0",
"ember-testing": "2.9.0"
},
"addons": {}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.