Skip to content

Instantly share code, notes, and snippets.

@danielhusar
Last active November 28, 2016 20:10
Show Gist options
  • Save danielhusar/7dc893147da63a87668ea1e3bff9aa19 to your computer and use it in GitHub Desktop.
Save danielhusar/7dc893147da63a87668ea1e3bff9aa19 to your computer and use it in GitHub Desktop.
intercom-one-way
import Ember from 'ember';
export default Ember.Component.extend({
actions: {
onChecked: function() {
this.checkboxCb();
}
}
});
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
checkbox: true,
doSomeStuff: function() {
console.log('req');
},
checkboxCb: function() {
// this.doSomeStuff is undefined because
// its called from my-component
// with my-component context
this.doSomeStuff();
}
});
<h1>Welcome to {{appName}}</h1>
<br>
<br>
{{outlet}}
{{my-component checkbox=checkbox checkboxCb=checkboxCb}}
<br>
<br>
Checkbox: {{one-way-checkbox checkbox update=(action 'onChecked')}}
{
"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": {
"ember-one-way-controls": "1.1.0"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment