Skip to content

Instantly share code, notes, and snippets.

@hvgotcodes
Last active August 24, 2016 20:01
Show Gist options
  • Save hvgotcodes/d989f3a6b15ad9acf20c992c2210cf9d to your computer and use it in GitHub Desktop.
Save hvgotcodes/d989f3a6b15ad9acf20c992c2210cf9d to your computer and use it in GitHub Desktop.
actions
import Ember from 'ember';
export default Ember.Component.extend({
scope: 'inner',
actions: {
fromOuter(){},
clicked(){
console.log('clicked', this.get('scope'));
this.get('fromOuter')();
}
}
});
import Ember from 'ember';
export default Ember.Component.extend({
scope: 'outer',
actions: {
forInner(){
console.log('for inner', this.get('scope'));
}
}
});
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
<h1>Welcome to {{appName}}</h1>
<br>
<br>
{{outer-component}}
<br>
<br>
Inner
<button type="button" onClick={{action 'clicked'}}>Click Me</button>
Outer
// change to 'forInner' and it errors
{{inner-component fromOuter=(action 'forInner')}}
{
"version": "0.10.4",
"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.7.0",
"ember-data": "2.7.0",
"ember-template-compiler": "2.7.0"
},
"addons": {}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment