Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save GavinJoyce/8823e678dd005844fdab6f72edbc4586 to your computer and use it in GitHub Desktop.
Save GavinJoyce/8823e678dd005844fdab6f72edbc4586 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');
},
actions: {
checkboxCb: function() {
// this.doSomeStuff is undefined because
// its called from my-component
// with my-component context
console.log('action context', this);
this.doSomeStuff();
}
}
});
<h1>Welcome to {{appName}}</h1>
<br>
<br>
{{outlet}}
{{my-component checkbox=checkbox checkboxCb=(action '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